CSS Property direction








direction specifies the base writing direction of blocks.

Summary

ItemValue
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

Example

An example showing how to use direction CSS property.

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

Click to view the demo