CSS right to left direction & floating elements

submit to reddit

direction:rtl

When developing a website for Arabic one of the most common questions is how to get it work with a reverse direction. Actually there is the CSS property direction:

.my-class {
    direction:rtl;
}

which makes the page right aligned.

Floating elements …

However sometimes there are elements on the page which are absolutely positioned and the direction property doesn’t do the job. The solution is something like combining the two settings. Both direction and float. So something like:

.my-class {
    float:left;
}

becomes something like:

.my-class {
    float:right;
    direction:rtl;
}

and of course if you’ve something like margin-left it should become margin-right!

Related posts:

  1. Fast way to manage the Arabic version of a web form
  2. jQuery CSS selectors. Change one or more CSS properties!
  3. CSS sprites. Go beyond the limits with base64!

You are a GREAT developer? Click here to answer the weekly quiz!

This entry was posted in css, micro tutorial and tagged , , . Bookmark the permalink.

One Response to CSS right to left direction & floating elements

  1. baris.m says:

    Cool, it’s quite underestimated.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">