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}
时间: 2024-10-08 01:43:16