表单单选按钮美化
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了表单单选按钮美化相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>单选按钮美化</title>
<style>
label{
position:relative;
display:inline-block;
cursor:pointer;
}
label>input{
display:none;
}
label .radio-inner{
position:relative;
padding-left:35px;
}
label .radio-inner:before{
content:‘‘;
position:absolute;
width:20px;
height:20px;
top:0;
left:0;
border:1px solid #d9d9d9;
border-radius:50%;
}
label .radio-inner:after{
content:‘‘;
position:absolute;
width:10px;
height:10px;
top:6px;
left:6px;
background:#fff;
border-radius:50%;
}
label>input:checked+.radio-inner:before{
border-color:#009a61;
}
label>input:checked+.radio-inner:after{
background:#009a61;
}
</style>
</head>
<body>
<label for="radio1">
<input type="radio" id="radio1" checked name="radio" />
<div class="radio-inner">
<div class="radio-title">radio1</div>
</div>
</label>
<label for="radio2">
<input type="radio" id="radio2" name="radio" />
<div class="radio-inner">
<div class="radio-title">radio2</div>
</div>
</label>
</body>
</html>
以上是关于表单单选按钮美化的主要内容,如果未能解决你的问题,请参考以下文章