我有以下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配合使用,我添加了一个使用jQuery切换的backup .checked类。即使JS被破坏,我也希望显示我的自定义复选框,因此我希望在CSS3中包含:checked伪选择器。
上面的顺序在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中读取。:(我该怎么办?
发布于 2012-10-18 18:45:23
当然,您也可以在CSS中添加注释。
然而,更好方法可能是简单地使用IE条件注释以不将代码包括在IE < 9中。
https://stackoverflow.com/questions/12961541
复制相似问题