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

后端 未结 5 1417
北海茫月
北海茫月 2020-12-02 19:45

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 / tex
5条回答
  •  北海茫月
    2020-12-02 20:10

    There is a CSS-only solution:

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

    jsFiddle

    Unfortunately this solution doesn't work with Microsoft Edge.

提交回复
热议问题