简体   繁体   中英

Nested selector of CSS doesnt work in IE8 but works in IE6?

Hi The below code works fine in IE6 but not in IE8 may i know what is causing the problem ?

<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>

Your CSS is wrong, it just seems to work in Internet Explorer 6 because it has a bug whereby it treats .foo.bar as .bar

You are looking for .foo .bar . ie "An element with class bar that is a descendent of an element with class foo" as opposed to what you have, which is "An element with both class foo and bar such as <div class='foo bar'> ".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM