html - 显示嵌套的 div 失败

标签 html internet-explorer css

我有一个这样的嵌套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/

相关文章:

html - DIV 仅在 chrome 中显示不同

html - CSS/webkit/animation 避免调整整个 div 的大小

css - bootstrap3中的col-lg和col-md有什么区别

html - 垂直对齐 Bootstrap 徽章和按钮内的文本

html - 用 border-radius 和 translate3d overflow hidden

javascript - 为什么使用 getClientRects() 的相同代码会产生不同的结果?

internet-explorer - IE 提示输入客户端证书但不发送

CSS 在 IE11 中旋转图像/图标(微调器)

c# - 部署 IE9 扩展

html - Zurb Foundation 6 菜单右对齐在小型设备上实现居中对齐的简便方法