Pet*_*ter 1 css css-selectors internet-explorer-9
好吧,我有以下HTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Gallery</title>
<link href="style.css" rel="stylesheet" />
</head>
<body>
<div>
<ul class="Boxes">
<li>
<span>Nature</span>
</li>
<li class="Add">
<div></div>
</li>
</ul>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
和以下css:
body {
background: black;
color: white;
}
body .Boxes li {
width: 192px;
height: 192px;
font-size: 2.5em;
background: rgb(27, 161, 226);
}
body .Boxes li.Add div {
background-position: 0px -352px;
width: 192px;
height: 192px;
background-image: url("Sprites.png");
background-repeat: no-repeat;
background-color: transparent;
}
.Boxes {
list-style-type: none;
float: left;
}
.Boxes li {
margin: 10px; border: 0px currentColor;
float: left;
display: block;
list-style-type: none;
}
Run Code Online (Sandbox Code Playgroud)
现在这很好用,但如果我改变行"body .Boxes li.Add div {"to"body .Boxes li.Add > div {"那么它在IE9中停止工作,我不明白为什么?注意:它仍然适用于Opera,Chrome ..
因为您缺少doctype声明:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Run Code Online (Sandbox Code Playgroud)
没有它,IE9将进入怪癖模式,在怪癖模式下,IE将无法识别>选择器等.这不会影响其他浏览器中的怪癖模式.
| 归档时间: |
|
| 查看次数: |
1072 次 |
| 最近记录: |