当前位置: 首页 > news >正文

radio checkbox 修改默认样式

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 
 4 <head>
 5     <meta charset="UTF-8">
 6     <title>radio与checbox修改默认样式</title>
 7     <style>
 8     body{font-size: 12px;}
 9     /*radio*/
10     
11     .radio-input label { font-weight: normal; }
12     .radio-input label { position: relative; width: 56px; }
13     .radio-input label:nth-child(2) { margin-left: 20px; }
14     .radio-input label:before { content: ""; display: inline-block; width: 14px; height: 14px; border: 1px solid #cfcfcf; border-radius: 50%; vertical-align: middle; margin-right: 5px; }
15     .radio-input input { width: 1px; height: 1px; opacity: 0; }
16     .radio-input input:checked + i { width: 8px; height: 8px; background-color: #5faee3; border-radius: 50%; position: absolute; top: 6px; left: 3px; }
17     @-moz-document url-prefix() {
18         .radio-input label { width: 100px; }
19         #turntable_form3 .radio-input label:nth-child(2) { margin-left: 0; }
20         #turntable_form3 .radio-input input:checked + i { top: 10px; }
21         #turntable_form3 .radio-input label:before { margin-right: -10px; }
22     }
23 
24     /*radio*/
25 
26     /*checkbox*/
27 
28     .c input[type="checkbox"] { width: auto; height: auto; opacity: 0; vertical-align: middle; }
29     .c i { display: inline-block; width: 14px; height: 14px; border: 1px solid #cfcfcf; text-align: center; line-height: 14px; margin-left: 8px; left: 0; position: absolute; }
30     .c input[type="checkbox"]:checked + i:before { content: "\2713"; display: inline-block; color: #de2230; }
31     .c label { position: relative; padding-left: 18px; margin-bottom: 0; }
32     /*checkbox*/
33     </style>
34 </head>
35 
36 <body>
37     <div class="control-input radio-input">
38         <label for="yes">
39             <input type="radio" name="use" id="yes" checked="checked"><i class="inline"></i>启用</label>
40         <label for="no">
41             <input type="radio" name="use" id="no"><i class="inline"></i>禁用</label>
42     </div>
43     <br><br><br><br><br>
44     <!-- checkbox -->
45     <div class="c">
46         <label>
47             <input type="checkbox" checked="checked" />全选<i></i>
48         </label>
49     </div>
50     <!-- checkbox -->
51 </body>
52 
53 </html>

 

2.checkbox

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta content="telephone=no" name="format-detection" />
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"
    />
    <title>test</title>
    <style>
        label {
            position: relative;
            cursor: pointer;
        }

        label .input {
            cursor: pointer;
        }

        input:checked+.show-box {
            background: white;
            /* 这里取个巧,与下面颜色一样而已*/
        }

        .show-box {
            position: absolute;
            top: 1px;
            left: 1px;
            width: 16px;
            height: 16px;
            border-radius: 2px;
            background: #ec6337;
        }

        .show-box:before {
            /* 使用了 absolute 所以无所谓是 before 还是 after*/
            content: '';
            /* 空白内容占位,当做盒模型处理,见下面*/
            position: absolute;
            top: 2px;
            left: 6px;
            width: 3px;
            /* 勾的短边*/
            height: 8px;
            /* 勾的长边*/
            border: solid white;
            /* 勾的颜色*/
            border-width: 0 2px 2px 0;
            /* 勾的宽度*/
            transform: rotate(45deg);
            /* 定制宽高加上旋转可以伪装内部的白色勾*/
        }
    </style>
</head>

<body>
    <label>
        <!-- 注意嵌在 label 里面 记住密码 -->
        <input type="checkbox" />
        <!--  注意嵌在 label 里面 -->
        <div class="show-box" />
    </label>


</body>

</html>

 

转载于:https://www.cnblogs.com/Doduo/p/6766896.html

相关文章:

  • CentOS搭建FTP
  • 黑马程序员 九、IO 操作(1)
  • 运行第一个Docker容器-Docker for Web Developers(1)
  • Linux 虚拟机--KVM安装和配置
  • 微软云Linux服务器 Mysql、tomcat远程连接错误解决办法
  • 认识htnl最基本的几个标签
  • ES6学习记录-let和var的区别
  • Java 集合类 List Set Map 哪些线程安全
  • 安装Python的机器学习包Sklearn 出错解决方法
  • 【干货】机器学习常见算法分类汇总
  • 《Selenium自动化测试指南》目录—导读
  • 一次耐人寻味的SQL优化:除了SQL改写,还要考虑什么?
  • 《HTML5 canvas开发详解(第2版)》——2.2 基本矩形
  • 《推荐系统:技术、评估及高效算法》一1.2 推荐系统的功能
  • 《jQuery Cookbook中文版》——1.11 删除DOM元素
  • 《微软的软件测试之道》成书始末、出版宣告、补充致谢名单及相关信息
  • 【面试系列】之二:关于js原型
  • Android Volley源码解析
  • ComponentOne 2017 V2版本正式发布
  • javascript 总结(常用工具类的封装)
  • MyEclipse 8.0 GA 搭建 Struts2 + Spring2 + Hibernate3 (测试)
  • storm drpc实例
  • 从零搭建Koa2 Server
  • 关于 Cirru Editor 存储格式
  • 基于Dubbo+ZooKeeper的分布式服务的实现
  • 跨域
  • 数据库巡检项
  • ​LeetCode解法汇总518. 零钱兑换 II
  • ​Linux·i2c驱动架构​
  • #etcd#安装时出错
  • #LLM入门|Prompt#1.8_聊天机器人_Chatbot
  • #我与Java虚拟机的故事#连载01:人在JVM,身不由己
  • #中的引用型是什么意识_Java中四种引用有什么区别以及应用场景
  • #周末课堂# 【Linux + JVM + Mysql高级性能优化班】(火热报名中~~~)
  • $ is not function   和JQUERY 命名 冲突的解说 Jquer问题 (
  • (2.2w字)前端单元测试之Jest详解篇
  • (HAL)STM32F103C6T8——软件模拟I2C驱动0.96寸OLED屏幕
  • (二十四)Flask之flask-session组件
  • (附源码)spring boot基于小程序酒店疫情系统 毕业设计 091931
  • (免费领源码)python+django+mysql线上兼职平台系统83320-计算机毕业设计项目选题推荐
  • (一) storm的集群安装与配置
  • (转)JAVA中的堆栈
  • (转)Scala的“=”符号简介
  • *p=a是把a的值赋给p,p=a是把a的地址赋给p。
  • .Net6支持的操作系统版本(.net8已来,你还在用.netframework4.5吗)
  • .NET设计模式(8):适配器模式(Adapter Pattern)
  • .net通用权限框架B/S (三)--MODEL层(2)
  • .net中应用SQL缓存(实例使用)
  • .set 数据导入matlab,设置变量导入选项 - MATLAB setvaropts - MathWorks 中国
  • .skip() 和 .only() 的使用
  • /bin/bash^M: bad interpreter: No such file ordirectory
  • /etc/fstab和/etc/mtab的区别
  • [2019/05/17]解决springboot测试List接口时JSON传参异常
  • [ABP实战开源项目]---ABP实时服务-通知系统.发布模式
  • [Android Studio 权威教程]断点调试和高级调试