HTML 中部分彩色的阿拉伯语单词 [英] Partially colored Arabic word in HTML

查看:25
本文介绍了HTML 中部分彩色的阿拉伯语单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不会说阿拉伯语,但我需要我们网站上的阿拉伯语特定支持.我需要将阿拉伯语单词的一部分放在 <span> 中,其风格与单词的其余部分不同.当我输入两个字符 شس 时,它们被组合成单词 شس,但是当我使用 HTML 标记时

I don't speak Arabic, but I need specific support for Arabic on our web. I need parts of Arabic words to be in a <span> with a different style than the rest of word. When I type two characters ش and س, they are composed into word شس, but when I use HTML markup

<span>ش</span>س

这些字母在输出中没有直接连接起来.

these letters are not concatenated right in the output.

在图中,期望输出在第二行,实际输出在第一行.

In the picture, desired output is on second line, actual output is on first line.

它适用于 Firefox,但不适用于 Chrome/Safari.

It works on Firefox, but does not work in Chrome/Safari.

推荐答案

span 的末尾插入一个零宽度连接符(例如使用实体引用 &zwj;) 元素内容:ش&zwj;س.

Insert a zero-width joiner (e.g. using the entity reference &zwj;) at the end of the span element content: <span>ش&zwj;</span>س.

更一般地说,每个 span 元素开始和结束处的零宽度连接器以及每个 span 元素之前和之后的(只是为了更确定), 在文本应该具有草书(连接)行为并且 span 可能会破坏它的情况下.

More generally, the zero-width joiners at the start and end of each span element as well as (just to be more sure) before and after each span element, in situations where the text should have cursive (joining) behavior and span may break it.

该问题在双向文本上进行了讨论和说明安德烈亚斯·普里洛普 (Andreas Prilop) 的页面.

The issue is discussed and illustrated on the Bidirectional text page by Andreas Prilop.

更新: 不幸的是,即使 &zwj; 似乎对当前版本的 WebKit 浏览器也没有帮助.无论如何,他们似乎都将 HTML 标记视为破坏连接行为.

Update: Unfortunately, it seems that even &zwj; does not help on current versions of WebKit browsers. They seem to treat HTML markup as breaking joining behavior, no matter what.

更新 2: 如@NasserAl-Wohaibi 的评论所述,新问题可以通过使用 &zwj; 两次来解决.但是,在当前用于 Windows 的 Safari (5.1.7) 中,它没有帮助;事实上,它甚至显示 ش&zwj;س 错误,而没有连接器,它可以正确显示 شس.

Update 2: As described in @NasserAl-Wohaibi’s comment, the new problem can be solved by using &zwj; twice. However, in current Safari (5.1.7) for Windows, it does not help; in fact, it displays even ش&zwj;س wrong whereas without the joiner, it shows شس correctly.

这篇关于HTML 中部分彩色的阿拉伯语单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆