• 利用CSS3选择器定制checkbox和radio


    之前在一个项目中需要定制checkbox,于是乎用图片模拟了一下,之后发现个更好用的方法(*因为兼容问题 在移动开发中用用就好)

    效果:

     实现代码:

    <style type="text/css">
        * { padding:0; margin:0;}
        #text { width:260px; margin:0 0 0 20px; padding:6px; border:4px solid #FC9; font-size:12px; color:white;}
        #text label { display:inline-block; margin:0 10px 0 0;} 
        #text span { display:inline-block; cursor:pointer; width:24px; line-height:24px; border-radius:15px; text-align:center; background:#ccc;}
        #text input { display:none;}
        #text label input:checked + span { background:#F96;}
    </style>
    <div id="text">
        <label>
            <input type="radio" value="1" name="muber" />
            <span>1</span>
        </label>
        <label>
            <input type="radio" value="2" name="muber" />
            <span>2</span>
        </label>
        <label>
            <input type="radio" value="3" name="muber" />
            <span>3</span>
        </label>
        <label>
            <input type="radio" value="4" name="muber" />
            <span>4</span>
        </label>
        <label>
            <input type="radio" value="5" name="muber" />
            <span>5</span>
        </label>
        <label>
            <input type="radio" value="6" name="muber" />
            <span>6</span>
        </label>
        <label>
            <input type="radio" value="7" name="muber" />
            <span>7</span>
        </label>
    </div>

     这里只是记录实现思想,简单的实现了一下,没做更多的效果拓展。发挥下想像力可以用CSS3做出各种炫酷的效果.

  • 相关阅读:
    c++<ctime>中常用函数
    头文件<cmath>中常用函数
    c++动态数组的使用
    迭代器与指针
    引用和指针做形参时的区别
    c++使用cin、cout与c中使用scanf、printf进行输入输出的效率问题
    c++指定输出小数的精度
    Linux命令学习(1)
    Nginx 配置文件nginx.conf中文详解
    Walle实现自动发布
  • 原文地址:https://www.cnblogs.com/lilixing/p/4612919.html
Copyright © 2020-2023  润新知