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/flex-grow.md.
Lynx
  • 简体中文
  • flex-grow

    介绍

    定义弹性项目在主轴的增长系数。这个属性规定了 flex-grow 项在弹性容器中分配剩余空间的相对比例。主尺寸是项的宽度或高度,这取决于 flex-direction 值。

    剩余空间是弹性容器的大小减去所有弹性项目的大小加起来的大小。如果所有的兄弟项目都有相同的 flex-grow 系数,那么所有的项目将剩余空间按相同比例分配,否则将根据不同的 flex-grow 定义的比例进行分配。

    flex-grow 与其他的 flex 属性 flex-shrinkflex-basis 一起使用,通常使用 flex 速记来定义,以确保所有的值都被设置。

    使用示例

    语法

    /* <number> 值 */
    flex-grow: 3;
    flex-grow: 0.6;

    取值

    • <number>

      负值无效,默认值0

    形式定义

    初始值0
    适用元素flex items
    是否支持继承
    是否支持动画yes

    形式语法

    flex-grow = <number>

    兼容性

    LCD tables only load in the browser

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