CSS | direction Property
The direction property specifies the direction of the text/writing within any block element. It can have two values rtl(right to left) or ltr( left to right)
Syntax:
element_selector {
direction: rtl|ltr|initial|inherit;
}
Property values:
- rtl: Specifies the direction as right to left.
- ltr(default): Specifies the direction as left to right which is also the default direction.
- initial: Sets the property to its default value.
- inherit: Inherits the property from the parent element.
Example:
<!DOCTYPE html> <html> <head> <title> CSS | direction Property </title> <style> html { color: green; } .rtl { direction: rtl; } .ltr { direction: ltr; } </style> </head> <body> <h1>GeeksforGeeks</h1> <p>This text goes from left to right. This is default.</p> <p class="ltr">This text goes from left to right.</p> <p class="rtl">This text goes from right to left.</p> </body> </html> |
chevron_right
filter_none
Output:

Supported Browsers: The browsers supported by direction property are listed below:
- Google Chrome 2.0
- Internet Explorer 5.5
- Firefox 1.0
- Opera 9.2
- Apple Safari 1.3
Recommended Posts:
- CSS | flex-direction Property
- CSS | animation-direction Property
- HTML | DOM Style direction Property
- How to traverse a C++ set in reverse direction
- HTML | Marquee direction attribute
- How to determine the direction of a jQuery scroll event?
- CSS | transition-property Property
- CSS | nav-up property
- CSS | nav-down property
- CSS | right Property
- CSS | top Property
- CSS | all Property
- CSS | nav-right property
- Web API | DOMRect right property
- CSS | clear Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



