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

    介绍

    定义弹性容器中的元件排列方向,该方向作为弹性容器的布局主轴,另外一个方向称为交叉轴。

    使用示例

    请注意,值 rowrow-reverse 受弹性容器的 direction 影响。如果它的 direction 属性是 ltrrow 表示从左到右定向的水平轴,而 row-reverse 表示从右到左; 如果 dir 属性是 rtl 或者 lynx-rtlrow 表示从右到左定向的轴,而 row-reverse 表示从左到右。

    语法

    /* The direction text is laid out in a line */
    flex-direction: row;
    
    /* Like <row>, but reversed */
    flex-direction: row-reverse;
    
    /* The direction in which lines of text are stacked */
    flex-direction: column;
    
    /* Like <column>, but reversed */
    flex-direction: column-reverse;

    取值

    • row

      默认值。flex 容器中的元件按照文本方向进行布局。主轴的方向和文本方向一致。

    • row-reverse

      row 的表现一致,但是置换了主轴起点和主轴终点。

    • column

      flex 容器中的元件按照书写模式的方向进行布局,主轴的方向和书写模式的方向一致。

    • column-reverse

      column 表现一致,但是置换了主轴起点和主轴终点。

    形式定义

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

    形式语法

    flex-direction =
      row             |
      row-reverse     |
      column          |
      column-reverse

    兼容性

    LCD tables only load in the browser

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