direction - HTML CSS CSS Property

HTML CSS examples for CSS Property:direction

Description

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.

Syntax

The syntax of the property is as follows:


direction:      ltr | rtl | initial | inherit

Property Values

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.

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials