我有一个这样的嵌套div
<div>
<div id="nested">
</div>
</div>
它的风格
#nested {
border: 1px solid #E2E2E2;
overflow: hidden;
padding-top: 5px;
text-align: left;
width: 10px;
}
但是在 IE7 上显示时,嵌套的“div”是居中对齐的。我应该在样式中添加什么新样式来覆盖以前的样式?
firebug 和 chrome 没有居中对齐的东西,只有 IE7 才有
我的页面结构是这样的
<html>
<body>
<html>
<body>
<div id="nested">
</div>
</body>
</html>
<body>
</html>
最佳答案
使用条件
http://css-tricks.com/snippets/html/add-body-class-just-for-ie/
示例
html
<!--[if IE 7 ]> <html dir="ltr" lang="en-US" class="no-js ie7 oldie"> <![endif]-->
CSS
html.ie7 #nested {
border: 1px solid #E2E2E2;
overflow: hidden;
padding-top: 5px;
text-align: left;
width: 10px;
float:left;
}
关于html - 显示嵌套的 div 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13522652/