问题
Why does
<input type="text" dir="rtl" value="08/15 word">
render into word 08/15
and not into 08/15 word
?
Why does
<input type="text" dir="rtl" value="one word">
render into one word
?
Why is the order switched in the first case but not in the second one?
https://jsfiddle.net/powtac/4aLn71mb/
回答1:
dir=RTL Characteristics
The order of digits in numbers (such as phone numbers) doesn’t differ from left-to-right writing.
When combining symbols that can be used in both RTL and LTR languages (such as periods, commas, or other punctuation marks), their displayed positions will depend on the direction of the text. This is because the data format starts from the beginning, but a browser is still processing an RTL word in the RTL direction and punctuation is converted towards the direction that has been specified.
For more information, see this article
来源:https://stackoverflow.com/questions/53947553/why-does-dir-rtl-change-order-but-only-sometimes