CSS Property direction

direction specifies the base writing direction of blocks.


Initial value ltr
Inherited Yes.
Version CSS2
JavaScript syntax object.style.direction="rtl"
Applies to All elements.

CSS Syntax

direction: ltr | rtl | inherit 

Property Values

The property values are listed in the following table.

Value Description
ltr left-to-right. Default value
rtl right-to-left
inherit Inherit the direction property from the parent element

Browser compatibility

direction Yes Yes Yes Yes Yes


An example showing how to use direction CSS property.

        .ltr {direction:ltr; }
        .rtl {direction:rtl; }
</head><!--from  w  ww  . j ava  2 s . c o m-->
    <p class="ltr">This text should flow left to right.</p>
    <p class="rtl">This text should flow right to left.</p>

Click to view the demo