For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/api/css/properties/direction.md.
Lynx
  • English
  • direction

    Introduction

    The direction CSS property sets the direction of text. Use rtl for languages written from right to left (like Hebrew or Arabic), and ltr for those written from left to right (like English and most other languages).

    Examples

    Syntax

    direction: normal;
    direction: ltr;
    direction: rtl;

    Values

    • normal

      Default value.

      The text-align:start will align the text according to the direction of text content and the direction of text will be inferred from the text content. All other behaviors are same as ltr.

      For example: For:

      <text> abc 1234 </text>

      The text will be left aligned. And the direction of the will be left to right.

      For:

      <text> العاشر ليونيكود 1234</text>

      The text will be right aligned. And the direction of the will be right to left.

    • ltr

      Text direction will be left-to-right, the horizontal logical properties "inline-start"(e.g. margin-inline-start) will be mapped to "left", and "inline-end" will be mapped to "right".

    • rtl

      Text direction will be right-to-left, the horizontal logical properties "inline-start"(e.g. margin-inline-start) will be mapped to "right", and "inline-end" will be mapped to "left".

    • lynx-rtl deprecated

      Not recommended. lynx only, designed for make ltr only pages compatible for rtl, Text direction will be right-to-left, properties "left", "inline-start" (e.g. margin-left) will be mapped to right, and "right", "inline-end" will be mapped to "left".

    Formal definition

    Initial valuenormal
    Applies toall elements
    Inheritedyes
    Animatable

    Formal syntax

    direction = normal | ltr | rtl

    Difference with the web

    • Value normal, lynx-rtl are introduced to improve page compatibility for rtl.

    Compatibility

    LCD tables only load in the browser

    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.