Why does dir=“rtl” change order, but only sometimes?

折月煮酒 提交于 2019-12-08 12:44:03

问题


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

  1. The order of digits in numbers (such as phone numbers) doesn’t differ from left-to-right writing.

  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!