日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

自定义单选框样式

發布時間:2025/4/16 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 自定义单选框样式 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<div class="user_sex"><p class="user_sex_span">性別</p><div class="sex"><div class="women"><label for="women">女</label><input type="radio" name="fruit" id="women" /><div class="user-defined"><span class="circle active"></span></div></div><div class="man"><label for="man">男</label><input type="radio" name="fruit" id="man" /><div class="user-defined"><span class="circle"></span></div></div></div></div>


/*性別單選框*/ input{padding: 0; margin: 0; border: 0;outline: none;} .sex:before { content: ""; display: table; } .sex:after { content: ""; display: table; clear: both; } .sex > div { position: relative; float: left;width:50px; height: 35px; line-height:35px; } .sex > div:last-child { margin-right: 0; } .sex label { display: block; width: 50px; height:35px; line-height: 35px; cursor: pointer;position: absolute;left: 20px} .sex input { z-index: 3; display: block; opacity: 0; position: absolute; top: 0; bottom: 0; left: 0; margin: auto; width:12px; height:12px; cursor: pointer; } .sex .user-defined { z-index: 2; position: absolute; top: 0; bottom: 0; left:0px; margin: auto; width:12px; height: 12px; border: 1px solid #f2572c; border-radius: 50%; cursor: pointer; } .sex .user-defined span.circle { display: block; width: 8px; height: 8px; margin-top:2px; margin-left: 2px; background-color: transparent; border-radius: 50%; } .sex .user-defined span.active { background-color: #f2572c; } /*性別單選框*/

//單選按鈕$(".women").on("click",function() {$(".user-defined>span",this).addClass("active");$(this).next().children().last().children().removeClass("active");});$(".man").on("click",function() {$(".user-defined>span",this).addClass("active");$(this).prev().children().last().children().removeClass("active");});




總結

以上是生活随笔為你收集整理的自定义单选框样式的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。