Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style direction Property

Style direction Property

Style Object Reference The Style object


Definition and Usage

The direction property sets or returns the text direction of an element.

Syntax

Set the direction property:

Object.style.direction="ltr|rtl|inherit"

Return the direction property:

Object.style.direction

Value Description
ltr Default. The text flows from left to right.
rtl The text flows from right to left.
inherit The text direction is inherited from the parent element.

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the direction property.

**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".


Example

Example

Set the text flow to right-to-left:

Runoob Tutorial(runoob.com)

This is some text.


Try it »


Style Object Reference The Style object