zoukankan      html  css  js  c++  java
  • 纯CSS+HTML自定义checkbox效果[转]

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>DIVCSS5 CSS?τ???? ?П?}</title>
    <style>
    .wrap {
    500px;
    background-color: #EEE;
    border: 2px solid #DEF;
    }

    input[type='checkbox'] {
    display: none;
    }

    label {
    display: inline-block;
    60px;
    height: 60px;
    position: relative;
    margin: 20px 120px 0 20px;
    background: url(../blank.png);
    background-position: 0 0px;
    -webkit-transition: background 0.5s linear;
    }

    input[type='checkbox']:checked+label {
    background-position: 0 -60px;
    }

    label::after {
    content: attr(data-name);
    /* 利用attr可以减少css代码量*/
    display: inline-block;
    position: relative;
    120px;
    height: 60px;
    left: 100%;
    vertical-align: middle;
    margin: 10px;
    /* line-height: 60px; */
    }
    </style>
    </head>
    <body>
    <div class="divcss5">
    <div class="wrap">
    <input type="checkbox" id="checkbox01" />
    <label for="checkbox01" data-name="点点点点"></label>
    <input type="checkbox" id="checkbox02" />
    <label for="checkbox02" data-name="点点点点"></label>
    <input type="checkbox" id="checkbox03" />
    <label for="checkbox03" data-name="点点点点"></label>
    <input type="checkbox" id="checkbox04" />
    <label for="checkbox04" data-name="点点点点"></label>
    <input type="checkbox" id="checkbox05" />
    <label for="checkbox05" data-name="点点点点"></label>
    <input type="checkbox" id="checkbox06" />
    <label for="checkbox06" data-name="点点点点"></label>
    <input type="checkbox" id="checkbox07" />
    <label for="checkbox07" data-name="点点点点"></label>
    <input type="checkbox" id="checkbox08" />
    <label for="checkbox08" data-name="点点点点"></label>
    <input type="checkbox" id="checkbox09" />
    <label for="checkbox09" data-name="点点点点"></label>
    <input type="checkbox" id="checkbox10" />
    <label for="checkbox10" data-name="点点点点"></label>
    </div>
    </div>
    </body>
    </html>

  • 相关阅读:
    Playwright安装及基本用法
    生成随机数、随机字符串
    xmind2testcase使用
    jmeter5.0二次开发环境搭建(IDEA)
    pytest配置文件pytest.ini
    pytest+allure2生成测试报告
    pytest生成html报告-使用pytest-html插件方式
    pytest一些简单参数
    pytest简单搭建和入门
    python3学习-元组
  • 原文地址:https://www.cnblogs.com/chenghu/p/5105690.html
Copyright © 2011-2022 走看看