自定义复选框checkbox

本文详细介绍了如何设计一个包含勾选框和用户协议文本的网页元素,确保用户能够明确阅读并同意服务协议。

//html

<div class="checkboxFive">
    <input type="checkbox" value="1" id="checkboxFiveInput" name="" />
    <label for="checkboxFiveInput"></label>
</div>
<div class="checkboxCont">已阅读并同意服务协议!</div>

 

 

//css样式

.checkboxFive { width: 18px; position: relative;}
.checkboxFive label { cursor: pointer; position: absolute; width: 18px; height: 18px; top: -1px; left: -1px; background: #0d97d7; border:1px solid #fff; border-radius: 5px;}
.checkboxFive label:after { opacity: 0.1; content: ''; position: absolute; width: 9px; height: 5px; background: transparent; top: 3px; left: 4px; border: 2px solid #fff; border-top: none; border-right: none; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -o-transform: rotate(-45deg); -ms-transform: rotate(-45deg); transform: rotate(-45deg);}
.checkboxFive label:hover::after { opacity: 0.1;}
.checkboxFive input[type=checkbox]:checked + label:after { opacity: 1;}
.checkboxCont{ line-height: 18px; padding-left: .5rem;}

 

转载于:https://www.cnblogs.com/allenfei/p/5069983.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值