适用于火狐,ie,等浏览器的复选框,单选框自定义样式
由于搜狐浏览器无法兼容伪类元素的原因,导致在IE等浏览器自定义的样式在搜狐上无法正常展现,针对这种问题在开发的时候很头疼,最终在一位博主的文章下找到答案,在次记录一下
/*复选框基本(未选中)的样式*/
input[type="checkbox"]{
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
display: inline-block;
vertical-align: middle;
width: 20px;
height: 20px;
color: #007dff;
background-image: url(/img/select.png);
background-size: 100% auto;
box-sizing:border-box;
background-position: 0 0;
background-color: white;
border:solid 1px #007dff;
}
/* 复选框鼠标按下时增加的样式 */
input[type="checkbox"]:active{
border:solid 1px #007dff;
background-color: #007dff;
outline: none;
border: 0;
}
/*复选框选中后增加的样式*/
input[type="checkbox"]:checked{
outline: none;
border:solid 1px #007dff;
background-color: #007dff;
border: 0;
}
/*复选框选中后增加的样式*/
input[type="checkbox"]:checked:active{
border:solid 1px #007dff;
background-color: #007dff;
border: 0;
}
/*单选框基本(未选中)的样式*/
input[type="radio"]{
outline: none;
border:solid 1px #007dff;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
outline: none;
display: block;
width: 18px;
height: 18px;
border-radius: 50%;
background-size: 100% auto;
box-sizing:border-box;
border:solid 1px #007dff;
}
/*单选按钮选中后增加的样式*/
input[type="radio"]:checked:before{
outline: none;
border:solid 1px #007dff;
content:"";
display: block;
width: 12px;
height: 12px;
margin: 2px;
border-radius: 10px;
background-color: #007dff;
}