Correct font sizes when LTR and RTL mixed
I have issues with font sizes when they are a mix of LTR and RTL contents. Say, I have text like this:
<p>في 12 ساعة</p>
It will be easy if I can place span with direction LRT to correct the font sizes, such as:
<p>في <span dir="ltr">12</span> ساعة</p>
But they are many and mixed, so placing a span is not possible inside some body text or titles.
As you see 12 is LTR. The rest are RTL.
My CSS defines:
p{font-size:16px;}
This 开发者_Python百科looks good for RTL, but too big for LTR(here, 12).
What I want: - keep font-size to 16px for RTL - make its LTR font-size 12px
Do you think there is a CSS property to scan automatically the direction without placing span tag for each LTR?
Any hint would be appreciated.
Thanks
Unfortunately you cannot "scan" the text with CSS. Try using a font that's not so small in Arabic. A 4px difference is too much if you ask me. I usually add 1px or 2px max for Arabic text. Try "Tahoma"(it's relatively big in Arabic text)
I wrote this example for you all text has 12px, but any text inside the p > span will have bigger text Now of course you can add class to the span in this case your css will change to http://jsfiddle.net/9uVD8/1/
p > span.className {....}
精彩评论