本文介绍了在从右到左的语言中(例如阿拉伯语和希伯来语),括号反向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我有一个字符串(在ltr中)

,当我使用dir = rtl或direction:rtl重定向字符串时,它实际上会去:

(实际上我刚进入希伯来语字符(3),现在它自动变成了上面的样子↑)



有什么办法使它成为

(使用html或css)

解决方案

您不需要将方括号中的文本包装在单独的跨度中。



相反,要解决此问题,请添加 RLM控制字符& rlm; )之后。 RLM字符充当另一个希伯来语/阿拉伯字符,因此方括号(这是一个较弱的字符)会改变方向并移至正确的位置。



就像这样:

 < div>מחיראחד(3)& rlm;< / div> 

NB:如果设置属性 dir

像这样:

 < div dir = rtl>מחיראחד(3)< / div> 

(jsFiddle by me)



此解释了RLM控制字符以及其他类似的控制字符。


Now I have a string like (in ltr)

and when I use dir="rtl" or direction:rtl to redirect the string it actually goes:

(actually i entered Hebrew charactor(3) just now it automaticlly became like above↑)

is there any way to make it like

(using html or css)

解决方案

You don't need to wrap the bracketed text in a separate span.

Rather, to fix this problem add a RLM control character (&rlm;) after the closing bracket. The RLM character acts as another Hebrew/Arabic character and so the bracket ( which is a weak character) changes its direction and moves to its correct place.

Like so:

<div>מחיר אחד(3)&rlm;</div>

NB: If you set the attribute dir="rtl" on the element - then even the RLM control character is unnecessary.

Like so:

<div dir="rtl">מחיר אחד(3)</div>

CODEPEN (jsFiddle down by me)

This microsoft doc explains the RLM control character along with other similar control characters.

这篇关于在从右到左的语言中(例如阿拉伯语和希伯来语),括号反向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 10:48