Reputation: 5150
I have a webpage, lets take for example StackOverflow. every box looks like this:
so my question is, how can I manage to do, when someone writes the title of the message in english it will show the message from Left to Right like in the image up, and when he writes from Right to Left it will show it like this:
it will automaticlly change the style of this box only. if its LTR use boxEnglish.css css for this spesific box and if its RTL, use boxHebrew.css for the spesific box. maybe I can give the user to choose RTL or LTR?
Thanks!
Upvotes: 1
Views: 3186
Reputation: 201528
In the example given, the title contains both English and Hebrew. It should not affect the overall directionality, as it has done in the example—are there real cases where this happens at StackOverflow? What should happen is just that the Hebrew part runs from right to left.
For safety, though, an application that inserts user input should normally set unicode-bidi: embed
(in CSS) on such elements, to avoid problems that may arise if the directionality of characters affects surrounding text.
You cannot base styling on the inherent directionality of letters. I don’t see why you would even want to do that. But the last remark about user choice suggests that the real question might be something different. If you wish to properly localize an application, then you would need to consider overall directionality as well, but that’s a different issue.
Upvotes: 7