Skip to: content, navigation

by Tommy Olsson and Paul O’Brien

direction (CSS property)

Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Full Full Full Full
Spec
Inherited Initial Version
Yes ltr CSS2
direction: { ltr | rtl | inherit } ;

Example

This style rule causes the columns in tables belonging to the "arabic" class to be laid out from right to left:

table.arabic {
  direction: rtl;
}

Try it yourself!View all demos

Description

This property specifies the following:

  • the base writing direction of blocks
  • the direction of embeddings and overrides—see unicode-bidi—for the Unicode bidirectional algorithm
  • the direction of table column layout
  • the direction of horizontal overflow
  • the position of an incomplete last line in a block, when the text-align property has the value justify

For the direction property to affect content reordering in inline elements, the unicode-bidi property must be set to embed or override.

The CSS2.1 specification emphasizes that this property should normally be used only by DTD designers. In particular, authors, web designers, and users shouldn’t override it.

Value

ltr
sets a left-to-right direction
rtl
sets a right-to-left direction

Compatibility

IE5.5Full
6.0Full
7.0Full
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

Related Reading

User-contributed notes

There are no comments yet.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters