首页 > Web开发 > 详细

纯css实现checkbox样式改变

时间:2019-12-18 23:20:44      阅读:106      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>checkbox</title>
    <style>
        .checkbox input {
            display: none;
        }
        
        .checkbox input+label {
            background: url(./checkbox1.png) left center no-repeat;
            background-size: 20px 20px;
            padding-left: 20px;
        }
        
        .checkbox input:checked+label {
            background-image: url(./checkbox2.png);
        }
    </style>
</head>

<body>
    <div class="checkbox">
        <input type="checkbox" checked id="music" />
        <label for="music">音乐</label>
        <input type="checkbox" id="sport" />
        <label for="sport">运动</label>
    </div>
</body>

</html>

技术分享图片

 

纯css实现checkbox样式改变

原文:https://www.cnblogs.com/Xuman0927/p/12063741.html

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