您的位置:首页 > Web前端 > CSS

修改 input[type=checkbox] 默认样式

2017-07-04 21:36 555 查看
html

<input type="checkbox">

css

input[type="checkbox"]{
position: relative;
}
input[type="checkbox"]:before{
position: absolute;
content: " ";
width:24px;
height: 24px;
border-radius:50%;
border:1px solid #dedede; 
top:-7px;
left:-7px;
background-color: #fff;
}
input[type="checkbox"]:checked:after{
position: absolute;
content: "";
width:15px;
height: 15px;
border-radius:50%;
background-color: red;
top:-2px;
left:-2px;
}

html

<a href="javascript:;" class="input-file">选择文件
<input type="file" name="" id="">

</a>

css

.input-file {
position: relative;
display: inline-block;
background: #f60;
border: 1px solid #f50;
border-radius: 2px;
overflow: hidden;
color: #fff;
font-size:20px;
text-decoration: none;
line-height: 20px;
text-align:center;

}

.input-file input[type=file] {
 position: absolute;
font-size: 100px;
right: 0;

top: 0;

opacity:0;

}

.input-file:hover {
background: #f50;
border-color: #f50;
color: #fff;
text-decoration: none;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: