gpt4 book ai didi

html - 如何不让 dir ='rtl' 向左侧发送 ./+ 等特殊字符?

转载 作者:行者123 更新时间:2023-11-27 23:54:35 25 4
gpt4 key购买 nike

当我尝试向 div 添加文本时(div 的 dir = RTL),它会将内容移到右侧。但是,它保留了特殊字符,如 ./+ 到左侧,如果它们是句子的最后一个字符。

例子:

<dir dir="RTL">Hello There!</dir>

输出将是:!你好

有人可以帮忙吗?

最佳答案

您需要使用 <bdi> (双向文本)标签来包装您的文本,see this article

<div dir="RTL">
<bdi>
Hello There!
</bdi>
</div>

More on bdi from MDN

很遗憾,这仅在 Chrome 和 FireFox 中受支持。

作为Jukka提到,这将有效地实现与右对齐文本相同的效果,在这种情况下,您应该这样做。

See here for a list of examples

关于html - 如何不让 dir ='rtl' 向左侧发送 ./+ 等特殊字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24800720/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com