dir div:
<div lang="ar" dir="rtl"></div>
<div lang="en" dir="ltr"></div>
This will automatically change the stream. However, you may need to customize certain elements depending on the language. You can do this using the CSS lang pseudo-language:
p:lang(ar) { text-align: right; }
p:lang(en) { text-align: left; }
Of course you could do this:
div:lang(en) { direction: ltr; }
div:lang(ar) { direction: rtl; }
This is an unacceptable method. Since you need to somehow set the language, you can also set the dir attribute. If you do this in some programming language, then you can usually determine the direction for a given spoken language (Locale, Culture, whatever). But that would be a different issue.
source
share