<div style="direction: rtl">
[x]y
</div>
您可以看到 HTML 文本 [x]y
显示为 x]y]
。
这个结果的原因是什么?
PS:我在 Chrome 56.0.2924.87(64 位)中得到了这个结果。
最佳答案
我不能告诉你原因,但我可以告诉你如何解决它:添加 unicode-bidi: bidi-override;
。参见 more关于它
<div style="direction: rtl; unicode-bidi: bidi-override;">
[x]y
</div>
描述
The unicode-bidi property is used together with the direction property to set or return whether the text should be overridden to support multiple languages in the same document.
不够清楚,无法解释该行为。但是,它有效。
编辑
The MDN article在这里带来了一些启发,bidi-override
实际上禁用了浏览器标准智能行为,并且一切都按原样/按预期工作。
关于html - 为什么 "[x]y"在RTL方向显示不正确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43973319/