【发布时间】:2016-06-26 13:26:00
【问题描述】:
如果“checkbox”和“radio”类型的输入是强制性的,我创建了一些css信息:
input[type=checkbox].is-mandatory::before {
position: absolute;
left: -5px;
top: -5px;
border: solid 1px #A94442;
border-radius: 4px;
width: 22px;
height: 22px;
content: "";
}
input[type=checkbox].is-mandatory::after {
position: absolute;
left: -4px;
top: -4px;
border: solid 4px #F2DEDE;
border-radius: 4px;
width: 20px;
height: 20px;
content: "";
}
<div class="checkbox">
<label>
<input class="is-mandatory" type="checkbox" id="chk0" name="chk0" value="0">
A simple checkbox (mandatory)
</label>
</div>
<div class="radio">
<label>
<input class="is-mandatory" type="radio" id="chk1" name="chk1" value="1">
A radio (mandatory)
</label>
</div>
不幸的是,它似乎只在 Chrome 中显示,而不在 FF44 和 IE11 中显示
styled checkbox and radio in chrome
css 声明中是否缺少某些东西以在 IE 和 FF 中获得与 Chrome 中相同的视图?
【问题讨论】:
-
stackoverflow.com/questions/3538506/… 的可能重复项。伪元素不适用于
input元素。
标签: forms css internet-explorer firefox pseudo-element