首页 > 其他 > 详细

自定义单选框,复选框样式

时间:2017-12-06 15:04:21      阅读:283      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>  
<html>  
    <head>  
        <meta charset="UTF-8">  
        <title></title>
        <style type="text/css">
            div{
                height: 50px;
                position: relative;
            }
            .rdo {
                width: 30px;
                height: 0px;
                background-color: #000;
                margin-right: 30px;
                border-radius: 50%;
                position: relative;
            }
            .rdo:before,.rdo:after {
                content: ‘‘;
                display: block;
                position: absolute;
                border-radius: 50%;
                transition: .3s ease;
                cursor: pointer;
            }
            .rdo:before {
                top: 0px;
                left: 0px;
                width: 18px;
                height: 18px;
                background-color: #fff;
                border: 1px solid #000;
            }
            .rdo:after {
                top: 6px;
                left: 6px;
                width: 8px;
                height: 8px;
                background-color: #fff;
            }
            .rdo:checked:after {
                top: 4px;
                left: 4px;
                width: 12px;
                height: 12px;
                background-color:#ea879a;
            }
            .rdo:checked:before {
                border-color:#ea879a;
            }
            label[for="q1"]{
                position: absolute;
                top: 15px;
                left: 35px;
                width: 8px;
                height: 8px;
                cursor: pointer;
            }
            label[for="q2"]{
                position: absolute;
                top: 15px;
                left: 104px;
                width: 8px;
                height: 8px;
                cursor: pointer;
            }
            .cb {
                width: 30px;
                height: 0px;
                background-color: #000;
                margin-right: 30px;
                position: relative;
            }
            .cb:before,.cb:after {
                content: ‘‘;
                display: block;
                position: absolute;
                transition: .3s ease;
                cursor: pointer;
            }
            .cb:before {
                top: 0px;
                left: 0px;
                width: 18px;
                height: 18px;
                background-color: #fff;
                border: 1px solid #000;
            }
            .cb:after {
                top: 6px;
                left: 6px;
                width: 8px;
                height: 8px;
                background-color: #fff;
            }
            .cb:checked:after {
                top: 4px;
                left: 4px;
                width: 12px;
                height: 12px;
                background-color:#ea879a;
            }
            .cb:checked:before {
                border-color:#ea879a;
            }
            label[for="q3"]{
                position: absolute;
                top: 15px;
                left: 35px;
                width: 8px;
                height: 8px;
                cursor: pointer;
            }
            label[for="q4"]{
                position: absolute;
                top: 15px;
                left: 104px;
                width: 8px;
                height: 8px;
                cursor: pointer;
            }
        </style>
    </head>  
    <body>
        <div>
            <label for="q1"></label><input type="radio" class="rdo" id="q1" name="sex" checked>
            <label for="q2"></label><input type="radio" class="rdo" id="q2" name="sex">
        </div>
        <div>
            <label for="q3"></label><input type="checkbox" class="cb" id="q3" name="sex" checked>
            <label for="q4"></label><input type="checkbox" class="cb" id="q4" name="sex">
        </div>

    </body>  
</html>  

 技术分享图片

自定义单选框,复选框样式

原文:http://www.cnblogs.com/xiaobaibubai/p/7992712.html

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