首页 > Web开发 > 详细

9.使用CSS样式,自己制作单选框样式和选中功能

时间:2020-04-11 13:05:32      阅读:58      评论:0      收藏:0      [点我收藏+]

自己制作单选框样式:

 

技术分享图片
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- reset.css文件内容参考:https://www.cnblogs.com/lanshanxiao/p/12663192.html -->
    <link rel="stylesheet" href="./reset.css">
    <style>
        .radio-diy .radiocircle {
            width: 12px;
            height: 12px;
            border: 1px solid #999;
            border-radius: 50%;
            cursor: pointer;
            display: inline-block;
        }
        
        .radio-diy input:checked+span {
            border: 1px solid#008c8c;
        }

        .radio-diy input:checked~span {
            color: #008c8c;
        }

        .radio-diy input:checked+span.radiocircle::after {
            content: "";
            display: block;
            width: 6px;
            height: 6px;
            background: #008c8c;
            border-radius: 50%;
            cursor: pointer;
            margin-left: 3px;
            margin-top: 3px;
        }



        input[type="radio"] {
            display: none;
        }
    </style>
</head>

<body>
    请选择性别:
    <label class="radio-diy">
        <input type="radio" name="gender" value="male">
        <span class="radiocircle"></span>
        <span>男</span>
    </label>
    <label class="radio-diy">
        <input type="radio" name="gender" value="female">
        <span class="radiocircle"></span>
        <span>女</span>
    </label>
</body>

</html>
radio.css

 

效果展示:

技术分享图片

 

9.使用CSS样式,自己制作单选框样式和选中功能

原文:https://www.cnblogs.com/lanshanxiao/p/12678812.html

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