zoukankan      html  css  js  c++  java
  • css 美化 input

    一、效果展示



    这里写图片描述
    二、实现步骤

        1、隐藏默认的样式

         -webkit-appearance: none;
         appearance: none;
         outline: none;

        1
        2
        3

        2、css3的对号样式

        content: "2713";

        1

        3、选中的css放到after选择器

        input[type=checkbox]:checked::after

        1

    三、全部实现代码 (直接复制到xxx.html就能看到效果)

    <html>
    <head>
        <style>
            label { /*flex布局让子元素水平垂直居中*/
                display: flex;
                align-items: center;
                justify-content: center;
            }

            input[type=checkbox],input[type=radio] {
                -webkit-appearance: none;
                appearance: none;
                outline: none;
                12px;
                height: 12px;
                cursor: pointer;
                vertical-align: center;
                background: #fff;
                border: 1px solid #ccc;
                position: relative;
            }

            input[type=checkbox]:checked::after {
                content: "2713";
                display: block;
                position: absolute;
                top: -1px;
                left: -1px;
                right: 0;
                bottom: 0;
                10px;
                height: 10px;
                line-height: 10px;
                border: 1px solid #ddd;
                color: red;
                font-size: 12px;
            }
            input[type=radio]:checked::after {
                content: "";
                display: block;
                position: absolute;
                top: 2px;
                left: 2px;
                right: 0;
                bottom: 0;
                6px;
                height: 6px;
                background-color: red;
            }
            input[type=radio], input[type=radio]:checked::after {
                border-radius: 50%;
            }
        </style>
    </head>

    <body>
    <label><input type="checkbox" />1111</label>
    <label><input type="checkbox" />222</label>
    <label><input type="radio" name="test"/>aaa</label>
    <label><input type="radio" name="test"/>bbb</label>
    </body>

    </html>
    ---------------------
    作者:mqy1023
    来源:CSDN
    原文:https://blog.csdn.net/mqy1023/article/details/78700433
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    数据库服务器 之 PostgreSQL安装和简单使用
    数据库服务器 之 sqlrelay 的安装配置和应用
    其他服务器 之 摄像头(WebCam)在Linux中采用Spcaserv 架设网络视频监控服务器 (v0.1b)
    数据库服务器 之 在Linux下使用perl通过unixODBC连接SQLServer2000
    文件服务器 之 ProFTPD 支持MySQL数据库添加虚拟用户认证及Quotas(磁盘限额)
    数据库服务器 之 PostgreSQL数据库用户认证
    Web 服务器 之 简易WWW服务器的架设
    Linux学习总结 (未完待续...)
    文件服务器 之 VSFTPD的高手篇
    文件服务器 之 SAMBA 服务器配置简明参考手册
  • 原文地址:https://www.cnblogs.com/hhj3645/p/9889915.html
Copyright © 2011-2022 走看看