开发者

Direction (LTR/RTL): What's the difference between the CSS direction and HTML direction attribute?

开发者 https://www.devze.com 2023-02-17 22:11 出处:网络
Is there any difference between <body dir=\"rtl\"> and <body style=\"directi开发者_运维百科on:rtl\">

Is there any difference between

<body dir="rtl">

and

<body style="directi开发者_运维百科on:rtl">

?


<body dir="rtl"> is more appropriate as per W3C recommendation:

http://www.w3.org/International/questions/qa-bidi-css-markup

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.

User-agents that ignore CSS will also benefit from this approach.

0

精彩评论

暂无评论...
验证码 换一张
取 消