CSS direction Property
Description
The direction CSS property establishes the base inline directionality for text and inline-level content within an element. It is the starting point for the Unicode Bidirectional Algorithm that resolves how runs of characters with different directional properties (for example, Arabic or Hebrew mixed with Latin) are ordered and displayed. When you set this property on an element, you change how neutral characters and weak directionality characters are resolved, which affects the visual order of words, punctuation placement at line ends, and the interpretation of embedding/override directions when used together with unicode-bidi.
Beyond text ordering, direction affects layout decisions that depend on the notion of “start” and “end” rather than the physical left and right. Many user-agent behaviors and higher-level CSS logical mappings use the base inline direction to decide which side is considered the inline start (for example, what “start” maps to when resolving alignment or logical margin/padding). This is why aligning inline content, resolving start/end values, and interpreting shorthand alignment can produce different visual results in an RTL context versus an LTR one; it interacts closely with alignment-related controls such as text-align and with writing orientation when combined with writing-mode.
Because direction is inherited, setting it on a root or container element provides a consistent base for its descendants, which is often desirable when building UIs for right-to-left languages. It also influences other runtime behaviors: caret movement and text selection respect the inline progression created by the base direction; some glyphs are mirrored by user agents when direction changes; and logical layout approaches (using start/end logical properties instead of physical left/right) are important to make components adapt correctly. In practice, prefer applying a single coherent base direction for document regions, use unicode-bidi only when you need fine-grained overrides, and test with mixed-script content to ensure punctuation, embedding, and selection behave as expected.
Definition
- Initial value
- ltr
- Applies to
- All elements
- Inherited
- Yes
- Computed value
- Specified value
- Animatable
- No
- JavaScript syntax
- object.style.direction
Interactive Demo
Syntax
direction: ltr | rtl
Values
- ltrThe direction of text and other elements go from left to right.
- rtlThe direction of text and other elements go from right to left.
- inherit
Example
Browser Support
The following information will show you the current browser support for the CSS direction property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
