简单的checkbox多选框样式修改(纯css3)

今天在做项目的时候有需要用到多选框,并且因为ui的关系,需要稍微美化一下多选框,所以找到了实现方法,挺实用的,不需要脚本就能实现。

前端布局如下:

<input class="select-tag-input" type="checkbox" id="tag-id"style="display: none;">
<label class="tag-label" for="tag-id"></label>


css如下:

/*checkbox样式*/
.select-tag-input + label{
    background-color: #eaeaea;
    /*border: 1px solid #C1CACA;*/
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05);
    padding: 9px;
    border-radius: 5px;
    display: inline-block;
    position: relative;
    margin-right: 18px;
    margin-top: 9px;
}


.select-tag-input + label:active {
    box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px 1px 3px rgba(0,0,0,0.1);
}


.select-tag-input:checked + label {
    background-color: #eaeaea;
    /*border: 1px solid #92A1AC;*/
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05), inset 15px 10px -12px rgba(255, 255, 255, 0.1);
    color: #243441;
}


.select-tag-input:checked + label:after {
    content: '\2714';
    position: absolute;
    top: -11px;
    left: 0px;
    color: #758794;
    width: 100%;
    text-align: center;
    font-size: 1.4em;
    padding: 1px 0 0 0;
    vertical-align: text-top;
}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值