CSS自定义checkbox样式

[type=checkbox]是过滤的意思,意思是说如果遇到type=checkbox的,就执行以下的样式。

input[type=checkbox],
input[type=radio]{
-webkit-appearance: none;
appearance: none;
width: 13px;
height: 13px;
margin: 0;
cursor: pointer;
vertical-align: bottom;
background: #fff;
border: 1px solid B9BBBE;
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
position: relative;
}

input[type=checkbox]:active,
input[type=radio]:active {
border-color: #c6c6c6;
background: #ebebeb;
}

input[type=checkbox]:hover {
border-color: #c6c6c6;
-webkit-box-shadow: inset 0 2px 2px rgba(0,0,0,0.1);
-moz-box-shadow: inset 0 2px 2px rgba(0,0,0,0.1);
box-shadow: inset 0 2px 2px rgba(0,0,0,0.1);
}

input[type=checkbox]:checked,
input[type=radio]:checked {
background: #fff;
}

input[type=checkbox]:checked::after {
content: url(http://ssl.gstatic.com/ui/v1/menu/checkmark.png);
display: block;
position: absolute;
top: -5px;
right: 0px;
left: -5px
}

input[type=checkbox]:focus {
outline: none;
border-color:#4d90fe;
}

猜你喜欢

转载自blog.csdn.net/jbguo/article/details/82344511