For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/css/properties/linear-cross-gravity.md.
Lynx
  • 简体中文
  • deprecated linear-cross-gravity

    Warning

    该 API 已被废弃。

    介绍

    线性布局中,子元件在垂直于父容器布局方向(交叉轴)上的位置,是父容器上的属性。类似于弹性布局align-items

    当在线性布局中同时使用 linear-layout-gravityalign-selflinear-cross-gravityalign-items 时,优先级从前到后依次降低。优先级高的会覆盖优先级低的样式。

    使用示例

    语法

    linear-cross-gravity: none;
    linear-cross-gravity: start;
    linear-cross-gravity: end;
    linear-cross-gravity: center;
    linear-cross-gravity: stretch;

    取值

    • none

      默认值。当容器(linear containers)的交叉轴上的大小(如 linear-direction: column 时的 width)固定,且该子元件在该方向的宽度为 auto 时,none 将等同于 stretch。在其他情况下则等同与 start

    • start

      子元件对齐父容器的交叉轴开始端。

    • end

      子元件对齐父容器的交叉轴结束端。

    • center

      子元件在父容器交叉轴居中。

    • stretch

      子元件填满父容器交叉轴。

    形式定义

    初始值none
    适用元素线性容器
    是否支持继承
    是否支持动画

    形式语法

    linear-cross-gravity = none | start | end | center | stretch

    与 Web 的区别

    • Web 无该样式。

    兼容性

    LCD tables only load in the browser

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。