方向(LTR / RTL):CSS方向和HTML方向属性有什么区别? [英] Direction (LTR/RTL): What's the difference between CSS direction and HTML direction attribute?
问题描述
所以,这之间有什么区别:
So, is there any difference between this:
<body dir="rtl">
和这个?:
<body style="direction:rtl">
推荐答案
< body dir = rtl>
更符合W3C的建议:
<body dir="rtl">
is more appropriate as per W3C recommendation:
http://www.w3.org/International/questions/qa-bidi-css-markup
由于方向性是文档结构的组成部分,因此标记应用于设置文档或信息块的方向性,或者标识文本中单独使用Unicode双向算法的位置不足以实现所需的方向性。 [...]因此,您应该在可用时使用专用的双向标记。
Because directionality is an integral part of the document structure, markup should be used to set the directionality for a document or chunk of information, or to identify places in the text where the Unicode bidirectional algorithm alone is insufficient to achieve desired directionality. [...] You should therefore use dedicated bidi markup whenever it is available. Do not simply attach CSS styling to a general element to achieve the effect.
忽略CSS的用户代理也将受益于这种方法。
User-agents that ignore CSS will also benefit from this approach.
这篇关于方向(LTR / RTL):CSS方向和HTML方向属性有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!