direction
specifies the base writing direction of blocks.
Item | Value |
---|---|
Initial value | ltr |
Inherited | Yes. |
Version | CSS2 |
JavaScript syntax | object.style.direction="rtl" |
Applies to | All elements. |
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 |
direction |
Yes | Yes | Yes | Yes | Yes |
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>