CSS的一些常用样式,如背景、文字、文本、表格、列表等,以及一些常用的场景,如居中对齐、溢出、隐藏元素等。01、常用样式 1.1、background背景 设置元素背景的样式 background,更
顺晟科技
2021-09-23 11:18:45
134
// html部分
<div class="Report_for_right">
<input type="radio" name="Report_radio">
<label></label>
</div>
//css
.Report_for_right{
float: right;
position: relative;
input{
z-index: 100;
}
input[type="radio"] {
/*width: 40px;*/
// 这里把默认的圆点透明度设置为0,并且把 label 标签的层级设置成高于默认的radio层级
opacity: 0;
z-index: 100!important;
height: 20px;
}
label {
position: absolute;
right: 10px;
top:12px;
border: 1px solid #ddd;
width: 15px;
height: 15px;
text-align: center;
// 点击显示成绿色部分,其实是radio的部分,只不过对radio进行了透明处理而已。
z-index:1;
/**/
border-radius: 50px;
color: #333;
}
input:checked+label {
background-color: #ff6160;
border-radius: 50px;
color: white;
}
}
注释:如有错误!请留言
09
2022-11
24
2022-10
19
2022-10
07
2022-10
07
2022-10
30
2022-09