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-gravity.md.
Lynx
  • 简体中文
  • deprecated linear-gravity

    Warning

    该 API 已被废弃。

    介绍

    linear-gravity 定义如何沿着线性布局主轴分配内容元件之间和周围的空间,是父容器上的属性。类似于弹性布局justify-content

    Info

    当同时使用 justify-contentlinear-gravitylinear-gravity 优先。

    使用示例

    语法

    linear-gravity: none;
    linear-gravity: start;
    linear-gravity: end;
    linear-gravity: center;
    linear-gravity: space-between;

    取值

    • none

      默认值linear-direction: column 时等同于 toplinear-direction: row 时等同于 left

    • start

      对齐父容器的主轴开始端。

    • end

      对齐父元件的主轴结束端。

    • center

      元件向每行中点排列。每行第一个元件到行首的距离将与每行最后一个元件到行尾的距离相同。

    • space-between

      对应布局方向上,两端对齐,中间间隔相等。

    • top deprecated

      向上对齐,纵向布局生效。

    • bottom deprecated

      向下对齐,纵向布局生效。

    • left deprecated

      向左对齐,横向布局生效。

    • right deprecated

      向右对齐,横向布局生效。

    • center-vertical deprecated

      垂直方向上居中,纵向布局生效。

    • center-horizontal deprecated

      水平方向上居中,横向布局生效。

    形式定义

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

    形式语法

    linear-gravity = none | start | end | center | space-between

    与 Web 的区别

    • Web 无该样式。

    兼容性

    LCD tables only load in the browser

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