Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use text-align smartly (if english dir=ltr if arabic dir=rtl)

I have a community web site and I want that users write

  • English posts with direction LTR / text-align: left) and
  • Arabic posts with direction RTL / text-align: right.

E.g. Google+ and twitter provides such an POST solution.

I want add automatically direction attribute to post when i read it from data base post load in rtl or ltr ! but i don't know how ?!

like image 522
Drstreet Avatar asked Aug 02 '12 23:08

Drstreet


1 Answers

There is a CSS-only solution:

div {
    text-align: start;
    unicode-bidi: plaintext;
}

jsFiddle

Unfortunately this solution doesn't work with Microsoft Edge.

like image 101
Nasser Sadraee Avatar answered Sep 22 '22 12:09

Nasser Sadraee