HTML CSS examples for CSS Property:direction
The direction property sets the writing direction (right to left, or left to right).
The following table summarizes the direction Property.
Item | Value |
---|---|
Default value: | ltr |
Applies to: | All elements |
Inherited: | Yes |
Animatable: | No. |
The syntax of the property is as follows:
direction: ltr | rtl | initial | inherit
The following table describes the values of this property.
Value | Description |
---|---|
ltr | Sets a left-to-right direction. This is default value. |
rtl | Sets a right-to-left direction. |
initial | Sets this property to its default value. |
inherit | take the value of its parent element direction property. |
The example below shows the direction property.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS direction property</title> <style type="text/css"> p {<!--from w w w .j av a 2 s .co m--> direction: ltr; unicode-bidi: bidi-override; } p.reverse { direction: rtl; unicode-bidi: bidi-override; } </style> </head> <body> <p>this is a test</p> <p class="reverse">this is a test</p> </body> </html>