码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-12-06 15:16:15      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:alt   blog   复选框   before   point   set   定义   分享   src   

<!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>  

 技术分享图片

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

标签:alt   blog   复选框   before   point   set   定义   分享   src   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!