0

I am working on a site which in in hebrew language. I added necessary hebrew font famuly and it's shows. But the problem is English language starts from left side and hebrew language is starts from right side. I used "text-align: right" for this. But the contents is not showing properly. Letter starts from left. How can i fix this to starts letter from right?

This site has also Contains English language in the footer.

Please can anyone help me?

Thanks in advance...

Here is the link- http://demo.nameinto.net/afarsec/

Blackboy
  • 21
  • 1
  • 3
  • 11

2 Answers2

0

Option 1. CSS's direction property

CSS has a direction property which you can use to set the text to render as rtl (right to left):

p {
    direction: rtl;
}

Option 2. HTML's dir attribute

Alternatively you can set the global dir attribute on an HTML element:

<p dir="rtl"> ... </p>
James Donnelly
  • 126,410
  • 34
  • 208
  • 218
  • The second one is the correct one. Set it on your `html` tag. – Wesley Murch May 27 '14 at 13:49
  • @Blackboy Yes, you should set the text direction on your whole document. CSS is for different purposes. From the reference link: "*Add dir="rtl" to the html tag any time the overall document direction is right-to-left. This sets the base direction for the whole document.*" See also: http://stackoverflow.com/questions/5375799/direction-ltr-rtl-whats-the-difference-between-css-direction-and-html-direct – Wesley Murch May 27 '14 at 13:51
  • You can override it back to `ltr` for left-to-right language on a specific element. – Wesley Murch May 27 '14 at 14:21
0

To handle "bidirectional" (AKA "right to left") languages such as Hebrew, there should be command codes to set "RTL" (right to left) display. I presume you're using UTF-8 as your encoding, which includes LTR and RTL codes.

Note that for embedded LTR languages such as English (to put an English phrase in the middle of a Hebrew sentence), you have to switch to LTR and then back to RTL, so that the English renders left to right.

Phil Perry
  • 2,126
  • 14
  • 18