首页 前端知识 用css html画一个checkbox

用css html画一个checkbox

2024-01-29 13:01:26 前端知识 前端哥 743 611 我要收藏
//css
.label {
display: flex;
justify-content: center;
align-content: center;
margin-top: 0.24rem;
line-height: 0.24rem;
}
.label p {
font-size: 0.12rem;
margin-left: 0.1rem;
}
.label .zfx-box {
width: 0.24rem;
border: 50%;
position: relative;
}
.label .zfx-box .checkbox {
width: 0.24rem;
background: #fff;
}
.label .zfx-box .checkbox:after {
content: " ";
display: block;
padding-top: 0.24rem;
}
.label .zfx-box .checked {
background: rgba(175, 143, 80, 0.3);
}
.label .zfx-box .container {
left: 0.09rem;
top: 0.03rem;
width: 0.08rem;
height: 0.16rem;
border-color: #fff;
border-style: solid;
border-width: 0 0.03rem 0.02rem 0;
transform: rotate(45deg);
position: absolute;
}
复制
//html
<div class="label">
<div class="zfx-box">
<div class="checkbox ">
<div class="container" style="display: none;"></div>
</div>
</div>
<p>游戏正式上线时将通过一下手机通知你,并在WI-FI环境下帮你下载该游戏</p>
</div>
复制
//jq
var checked=false
$(".checkbox").on('click',function(){
checked=!checked
if(checked){
$(this).removeClass("checked")
$(".container").hide()
}else{
$(this).addClass("checked")
$(".container").show()
}
})
复制
转载请注明出处或者链接地址:https://www.qianduange.cn//article/755.html
标签
js
评论
还可以输入200
共0条数据,当前/页
发布的文章

HTML5 css3课后习题【一】

2024-02-10 19:02:20

css3 table表格

2024-02-10 19:02:01

CSS 基础知识 选择器

2024-02-10 19:02:50

float,flex和grid布局

2024-02-10 19:02:41

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!