首页 > 其他 > 详细

checkbox复选框自定义背景颜色和选中样式

时间:2020-05-11 13:50:10      阅读:514      评论:0      收藏:0      [点我收藏+]

效果图如下:

技术分享图片

 

 技术分享图片

 

/* css 复选框 */
    input[type=checkbox] {
        cursor: pointer;
        position: relative;
    }

    input[type=checkbox]::after {
        position: absolute;
        top: 0;
        background-color: #fff;
        color: #fff;
        width: 14px;
        height: 14px;
        display: inline-block;
        visibility: visible;
        padding-left: 0px;
        text-align: center;
        content: ‘ ‘;
        border-radius: 2px;
        box-sizing: border-box;
        border: 1px solid #ddd;
    }

    input[type=checkbox]:checked::after {
        content: "";
        background-color: #037DF3;
        border-color: #037DF3;
        background-color: #037DF3;
    }

    input[type=checkbox]:checked::before {
        content: ‘‘;
        position: absolute;
        top: 1px;
        left: 5px;
        width: 3px;
        height: 8px;
        border: solid white;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg);
        z-index: 1;
    }
<!-- html -->
<input type="checkbox">

 

checkbox复选框自定义背景颜色和选中样式

原文:https://www.cnblogs.com/grow-up-up/p/12868520.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!