Note: This question is not answered in the above linked question, nor is it a duplicate. This question addresses the problem with the ordering of special characters when using text-direction: rtl
, which it turns out can be solved with the unicode-bidi: bidi-override
as pointed out by @Serlite below.
I have a div containing some text that I'd like to overflow to the left, not to the right.
For example, if the div contains all letters of the alphabet, the default behaviour is as follows:
I, however, want the contents of the div to be displayed like this:
Using direction: rtl
in the styles for that div works fine, and achieves this effect perfectly for the above example, as well as if the contents contains just numbers (or a mix of alphanumeric characters) as shown below.
Standard behaviour:
Behaviour after setting direction: rtl
:
The problem occurs when special characters are entered into the div, such as * and #.
Setting the string *#0123456789
as the div contents causes the following to be displayed:
Note the *
moving from the start of the string to the end.
It's difficult to show the problem with just images, so here is a quick jsfiddle to better demonstrate it.
In general, it seems like weird things happen when setting the direction
property, and so I'm guessing it's probably not the way to go.
Is there a way I can force the last characters to always be visible while the first characters overflow to the left?