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

checkbox和radio元素的样式设置(简易版)

时间:2017-11-04 13:29:44      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:one   12px   span   设置   isp   color   blog   col   css   

html代码

//html
<div>
    <p style="font-size:18px;margin-top:30px;color:rgba(0,0,0,0.44)">约吗?</p>
    <label class="demo--label">
        <input class="demo--radio" type="radio" name="demo-radio">
        <span class="demo--radioInput"></span>约
    </label>
    <label class="demo--label">
        <input class="demo--radio" type="radio" name="demo-radio">
        <span class="demo--radioInput"></span>不约
    </label>
</div>
<div>
    <p style="font-size:18px;margin-top:30px;color:rgba(0,0,0,0.44)">我帅不帅?</p>
    <label class="demo--label"><input class="demo--radio" type="checkbox" name="demo-checkbox1">
        <span class="demo--checkbox demo--radioInput"></span>帅
    </label>
    <label class="demo--label">
        <input class="demo--radio" type="checkbox" name="demo-checkbox2">
        <span class="demo--checkbox demo--radioInput"></span>很帅
    </label>
    <label class="demo--label">
        <input class="demo--radio" type="checkbox" name="demo-checkbox3">
        <span class="demo--checkbox demo--radioInput"></span>超级帅
    </label>
</div>

 css代码(网页)

//css(网页)
.demo--label{margin:20px 20px 0 0;display:inline-block}
.demo--radio{display:none}
.demo--radioInput{background-color:#fff;border:1px solid rgba(0,0,0,0.15);border-radius:100%;display:inline-block;width:16px;height:16px;margin-right:10px;margin-top:-1px;vertical-align:middle;line-height:1}
.demo--radio:checked + .demo--radioInput:after{background-color:#57ad68;border-radius:100%;content:"";display:inline-block;width:12px;height:12px;margin:2px;}
.demo--checkbox.demo--radioInput,.demo--radio:checked + .demo--checkbox.demo--radioInput:after{border-radius:0}

 css代码(手机)

//css(手机)
.demo--label{display:inline-block;font-size: pRem(22)}
.demo--radio{display:none}
.demo--radioInput{background-color:#fff;border:1px solid rgba(0,0,0,0.15);border-radius:100%;display:inline-block;width:pRem(20);height:pRem(20);margin-right:pRem(4);margin-top:-2px;vertical-align:middle;line-height:1;position: relative;}
.demo--radio:checked + .demo--radioInput:after{background-color:#57ad68;border-radius:100%;content:"";display:inline-block;width:pRem(16);height:pRem(16);position: absolute;top: pRem(2);left: pRem(2);}
.demo--checkbox.demo--radioInput,.demo--radio:checked + .demo--checkbox.demo--radioInput:after{border-radius:0}

  

checkbox和radio元素的样式设置(简易版)

标签:one   12px   span   设置   isp   color   blog   col   css   

原文地址:http://www.cnblogs.com/Code-Inconnu/p/7782775.html

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