码迷,mamicode.com
首页 > 其他好文 > 详细

direction和unicode-bidi

时间:2017-02-07 19:01:53      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:rect   这不   空格   border   ase   pac   href   ref   with   

CSS22文档里9.10

基本上看不懂讲什么,很多定义可能在提到的UAX9的文档里,也懒得看了。

在stackoverflow里找到了一个问答,简单的解释了direction和unicode-bidi的作用。涉及到字符的方向属性的强弱。在那个unicode bididirectional algorithm basic里有看到过。

就看看提问者的demo和回答者对于demo的解释。

技术分享
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<span style="direction:rtl;unicode-bidi:embed"> James</span>:15<br/>
<span style="direction:rtl;"> James:</span>15
</body>
</html>
View Code

浏览器里是这样的:

技术分享

解释:

The meaning of embedding is ultimately defined in UAX #9 Unicode Bidirectional Algorithm. I don’t want to pretend to understand all of it, but here is what I think happens in your case:

embedding 的完全的定义在UAX#9上可以看到,我不不想完全理解所有的内容,但是这样下面是我认为的你的case发生的:

In the second part of your code, you just declare right-to-left direction for the string “ James”. This has no effect, since the direction property affects only the overall layout direction (e.g., whether table columns run left to right or right to left) and the text direction of directionally neutral text. Here the content has just Latin letters, which have strong left-to-right directionality, and a space, which adapts to the directionality of the adjacent character with strong directionality.

在你代码的第二部分,你只是声明了右到左的direction给了字符串james。这不会产生任何效果出来,因为direction的属性只会影响一整块之间的方向的布局(比如:表格的column是从左到右,还是从右到左。),和直接的中性的文字的方向。这里的内容是Latin文字,是有强的左到右的方向的,还有一个空格,适应了相邻空格字符的强方向。

In the first part, however, declaring unicode-bidi:embed causes the element as a whole to be treated according to its declared directionality, right to left, even though that directionality has no impact inside the element. In a sense, it acts like a single right-to-left letter. Marking it with X, we thus have X:15. This gets rendered the same way as if X were an Arabic letter: this directionally strong letter appears on the right, then, to the left of it, the directionally weak punctuation mark “:”, and then the common digits 15 running left to right (as they do even inside Arabic text).

在第一部分,不同的是,声明了unicode-bidi:embed 导致了元素在方向上作为一个整体来对待,右往左,尽管不会影响里面的元素。换句话说,就好象一个单独的右到左语言的字母。用X来标记他,我们就有了X:15。这和X是一个阿拉伯字母一样:这个方向性强的字母出现在右边,然后,左边的方向性弱的冒号“:”,然后是普通的数字15从左往右。(就好象他们在阿拉伯文里出现一样)

direction和unicode-bidi

标签:rect   这不   空格   border   ase   pac   href   ref   with   

原文地址:http://www.cnblogs.com/mize/p/6375355.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!