CSS 属性

direction 属性设置文本、表格列和水平溢出的方向。

属性值

  • ltr: 文本其他元素将从左到右渲染。这是默认值。

  • rtl: 文本和其他元素将从右向左呈现。它用于具有从右到左脚本的语言。

为了使 Direction 属性对内联级元素产生任何影响,unicode-bidi 属性的值必须embed或override。

适用范围

所有 HTML

DOM 语法

object.style.direction = "ltr"; 

    CSS direction: ltr 

    以下示例演示了 Direction:ltr:

    <html>
    <body>
       <h2>CSS direction: ltr </h2>
       <p style = "direction:ltr;">
          文本方向 从左到右
       </p>
    </body>
    </html> 
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    CSS direction: rtl

    以下示例演示了方向:rtl:

    <html>
    <body>
       <h2>CSS direction: rtl </h2>
       <p style = "direction:rtl;">
          文本方向 从右到左
       </p>
    </body>
    </html> 
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7