direction
Description
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. |
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>
The code above generates the following result.