HTML 中的 RTL 布局错误 - CSS 覆盖不起作用
不知何故,dir =“rtl”下的CSS覆盖(左|右)似乎不起作用。
对于 verigy - 在 Chrome / Firebug 中:仅当禁用“left”属性时,覆盖的“left”(在 .dir_rtl #main_search_wrapper 下)样式开始影响实际布局。
看起来像是一个常见的浏览器错误?
以下是以下代码的实时示例: http://jsfiddle.net/DwRLz/
#main_search_wrapper {
display: inline-block;
position: absolute;
right: 0;
}
.dir_rtl #main_search_wrapper {
left: 0;
/* <-- This should override the above style */
}
<body class="dir_rtl" dir="rtl">
<div id="main_search_wrapper" style="display: inline-block;">
This should be aligned to the left.
</div>
</body>
somehow the CSS overrides (left|right) under dir="rtl" don't seem to work.
To verigy - in Chrome / Firebug: only when disabling the "left" attribute, the overriding "left" (under .dir_rtl #main_search_wrapper) style starts affecting the actual layout.
Looks like a common browsers bug?
Here's a live example of the code below: http://jsfiddle.net/DwRLz/
#main_search_wrapper {
display: inline-block;
position: absolute;
right: 0;
}
.dir_rtl #main_search_wrapper {
left: 0;
/* <-- This should override the above style */
}
<body class="dir_rtl" dir="rtl">
<div id="main_search_wrapper" style="display: inline-block;">
This should be aligned to the left.
</div>
</body>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
left
不一定覆盖right
,它会使用 both 属性,基本上像这样设置它们:试试这个:
left
doesn't necessarily overrideright
, it will use both properties, basically setting them like so:Try this:
尝试使用 bdo 标记。
Try to use bdo tag if you want to align text left.