我有以下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,因此我要保留CSS3中包含的伪selector的原因。
上面的顺序在IE 8中的表现不佳。似乎忽略了:检查语句之后的所有内容。
.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&lt中;9。