direction

Description

direction specifies the base writing direction of blocks.

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

Syntax and Property Values


direction: ltr | rtl | inherit 

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

Example


<!DOCTYPE HTML>
<html>
<head>
    <style>
        .ltr {direction:ltr; }
        .rtl {direction:rtl; }
    </style>
</head><!-- w w w .j  a v a2s  . com-->
<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

The code above generates the following result.

direction




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference