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>

  • 相关阅读:
    poj 2262
    poj 1050
    poj 1730
    poj 1061
    【设计模式】简单工厂模式学习
    【待学】
    [设计模式]策略模式和单一职责
    Windows live writer 误删 草稿 恢复
    [Linq]Linq To Sql (2)
    MVC 学习日志1(上)
  • 原文地址:https://www.cnblogs.com/chenghu/p/5105690.html
Copyright © 2011-2022 走看看