css - CSS 的嵌套选择器在 IE8 中不起作用但在 IE6 中起作用?

标签 css internet-explorer-8

您好,下面的代码在 IE6 中运行良好,但在 IE8 中运行不正常,我可以知道是什么导致了这个问题吗?

<html>
<head>
<style type="text/css">
  .dataSection {
     font-weight:bold;
     color:#fff;font-family:Verdana, Arial, Helvetica;
     text-align:left;
     background-color:#004E82;
     padding:2px 4px 2px 2px;
  }
  .dataSection.header {
     font-weight:bold;
     color:#fff;
     font-family:Verdana, Arial, Helvetica;
     text-align:left;
     background-color:#004E82;
     padding:2px 4px 2px 2px;
  }
</style>

</head>
<body>
<table class="DataSection">
<tr>
  <td class="header">Summary</td>
</tr>
</table>
</body>
</html>

最佳答案

你的 CSS 是错误的,它似乎只能在 Internet Explorer 6 中工作,因为它有一个错误,它会处理 .foo.bar作为.bar

您正在寻找.foo .bar .即“具有 bar 类的元素是具有类 foo 的元素的后代”,而不是您所拥有的“具有类 foo 和 bar 的元素,例如 <div class='foo bar'>”。

关于css - CSS 的嵌套选择器在 IE8 中不起作用但在 IE6 中起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3496742/

相关文章:

html - 有没有一种方法可以缩放站点以适应所有屏幕并且仍然显示所有内容而无需滚动条?

javascript - MSI 的 HTA 安装程序失败

css - IE7 和 IE8 之间 Web 应用程序的小问题

javascript - 日期函数在 IE8 中不起作用

html - 使用 HTML5 和 Css3 解决 IE8 问题的最佳解决方案是什么

html - 布局更改的 CSS 转换(其他元素显示在 DOM 中)?

php - CSS 和 Javascript 不工作!浏览器无法读取 css 和 javascript 文件

css - 在 div 中居中图像?

html - 同页 anchor 链接到部分 id 在 IE8 中不起作用

html - 使 float div 填充空白