纯css实现单选框样式
- html代码
<h2>你最喜欢的水果</h2>
<div class="input-radio">
<!-- 选中状态添加 checked 属性 -->
<input id="apple" type="radio" name="fruits" checked />
<label for="apple">苹果</label>
</div>
<div class="input-radio">
<input id="banana" type="radio" name="fruits" />
<label for="banana">香蕉</label>
</div>
<div class="input-radio">
<input id="orange" type="radio" name="fruits" />
<label for="orange">橙子</label>
</div>
<div class="input-radio">
<input id="strawberry" type="radio" name="fruits" />
<label for="strawberry">草莓</label>
</div>
2.css代码
.input-radio {
margin: 1em 0;
display:inline-block;
}
.input-radio input[type="radio"] {
opacity:;
}
.input-radio input[type="radio"] + label{
position: relative;
cursor: pointer;
}
.input-radio input[type="radio"] + label::before{
content: '';
position: absolute;
left: -24px;
border-radius: 50%;
width: 18px;
height: 18px;
border: 1px solid #999;
}
.input-radio input[type="radio"] + label::after{
content: '';
position: absolute;
left: -20px;
top: 4px;
border-radius: 50%;
width: 12px;
height: 12px;
}
.input-radio input[type="radio"]:checked + label::before{
border: 1px solid #24B7E5;
box-shadow: 0 0 6px #24B7E5;
transition: all .3s;
}
.input-radio input[type="radio"]:checked + label::after{
background:#24B7E5;
transition: all .5s;
}
3.效果

纯css实现单选框样式的更多相关文章
- vue.单选和多选,纯css自定义单选框样式
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 用css实现html中单选框样式改变
我们都知道,input的单选框是一个小圆框,不能直接更改样式.但是我们在很多网页中看到的单选框样式可不仅限于默认的那个样式(看上去没啥新意,也比较丑).那么,接下来我将介绍下如何实现该功能. 首先, ...
- 复选框、单选框样式自定义(https://www.cnblogs.com/freedom-feng/p/11346396.html)
复选框.单选框样式自定义(https://www.cnblogs.com/freedom-feng/p/11346396.html)复选框html内容如下:<input type="c ...
- 纯css美化下拉框、复选框以及单选框样式并用jquery获取到其被选中的val
具体样式如图所示: 注:获取val值时记得要先引入jquery库奥. 1.下拉框 css部分 #cargo_type_id{ font-size: 13px; border: solid 1px #b ...
- 纯css美化单选、复选框
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- js自定义修改复选框单选框样式,清除复选框单选框默认样式
之前做项目的时候,也遇到过需要按照设计稿把<input type="checkbox">和<input type="radio">的默认 ...
- 使用checkbox实现纯CSS下拉框
在这个例子中,我们会看到一个纯CSS制作的下拉框.主要是要用到了HTML元素的checkbox 和CSS3选择器,并没有用到JavaScript.例子如下: Click to Expand Link ...
- 纯css修改单选、复选按钮样式
只支持IE9及以上 html <label><input class="radio" type="radio" name="radi ...
- css 单选框 样式 填充自定义背景 after
input[type='radio'] //width 16px //height 16px display none //input[type='radio']:chcked // backgoun ...
随机推荐
- Codeforces Round #427 (Div. 2) [ C. Star sky ] [ D. Palindromic characteristics ] [ E. The penguin's game ]
本来准备好好打一场的,然而无奈腹痛只能带星号参加 (我才不是怕被打爆呢!) PROBLEM C - Star sky 题 OvO http://codeforces.com/contest/835/p ...
- jquery image选择器 语法
jquery image选择器 语法 作用::image 选择器选取类型为 image 的 <input> 元素.无锡大理石测量平台 语法:$(":image") jq ...
- C语言中的位域[转]
有些信息在存储时,并不需要占用一个完整的字节,而只需要一个或几个二进制位即可;比如:在存放一个开关量时,只有0和1两种状态,只需要使用一个二进制位即可存储;为了节省存储空间,C语言提供了一种数据结构, ...
- 重启php7.0-fpm
/etc/init.d/php7.0-fpm restart
- 3dmax 欢迎页卡住
C:\Program Files (x86)\Autodesk\3ds Max 9\stdplugs\dxplugins\dxDDS.mbi,把dxDDS.mbi重命名就OK了,只不过会提示他加载错误 ...
- Spring Boot教程(四十一)LDAP来管理用户信息(1)
LDAP简介 LDAP(轻量级目录访问协议,Lightweight Directory Access Protocol)是实现提供被称为目录服务的信息服务.目录服务是一种特殊的数据库系统,其专门针对读 ...
- Centos 7 下安装LDAP 双主同步
Centos 7 下安装LDAP 双主同步 标签(空格分隔): LDAP 安装说明: 从OpenLDAP2.4.23版本开始所有配置数据都保存在slapd.d目录下的cn=config文件夹中,不再使 ...
- apache httpd.conf 文件的 详解
文章 摘自 :http://www.php100.com/html/webkaifa/apache/2009/0418/1192.html ServerRoot /usr/local Server ...
- Excel表格写入操作函数 C++
#pragma once #include <stdio.h> #include <string.h> typedef unsigned short ushort; class ...
- windows10下如何完全卸载串口驱动?
答: 所需步骤如下: 1. 以管理员身份启动cmd 2. 在cmd中输入两行命令来启动设备管理器 3. 设置view->Show hidden devices 4. 在Ports (COM &a ...