我有以下 CSS:
.mcRow input.mcCheckbox {
display:none;
}
.mcRow input.mcCheckbox + label {
background: url('/media/img/pt/dhtml/mc_off.gif') no-repeat;
height: 19px;
width: 19px;
display:inline-block;
padding: 0px;
padding-left: 20px;
width: auto;
}
.mcRow input.mcCheckbox:checked + label {
background: url('/media/img/pt/dhtml/mc_on.gif') no-repeat;
}
.mcRow input.mcCheckbox.checked + label {
background: url('/media/img/pt/dhtml/mc_on.gif') no-repeat;
}
由于 IE8 不能很好地与 CSS3 配合使用,因此我包含了一个备用的 .checked 类,它使用 jQuery 进行切换。我希望我的自定义复选框即使 JS 损坏也能显示,因此我想保留 :checked 伪选择器包含在 CSS3 中。
上面的命令在 IE 8 中不能很好地运行。它似乎忽略了 :checked 语句之后的所有内容。
.mcRow input.mcCheckbox + label {
background: url('/media/img/pt/dhtml/mc_off.gif') no-repeat;
height: 19px;
width: 19px;
display:inline-block;
padding: 0px;
padding-left: 20px;
width: auto;
}
.mcRow input.mcCheckbox.checked + label {
background: url('/media/img/pt/dhtml/mc_on.gif') no-repeat;
}
.mcRow input.mcCheckbox:checked + label {
background: url('/media/img/pt/dhtml/mc_on.gif') no-repeat;
}
工作正常。我害怕将此添加到文件中,并且有人在此语句之后添加其他 CSS,不知道在 IE8 中不会读取任何内容。 :( 我该怎么办?
最佳答案
好吧,您当然可以在 CSS 中添加注释。
但是,更好的方法可能是简单地使用 IE 条件注释来不在 IE < 9 中包含该代码。
关于internet-explorer - CSS3 上的 IE8 阻塞——避免它不读取文件的其余部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12961541/