纯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 ...
随机推荐
- 2017"百度之星"程序设计大赛 - 初赛(A) [ hdu 6108 小C的倍数问题 ] [ hdu 6109 数据分割 ] [ hdu 6110 路径交 ] [ hdu 6112 今夕何夕 ] [ hdu 6113 度度熊的01世界 ]
这套题体验极差. PROBLEM 1001 - 小C的倍数问题 题 OvO http://acm.hdu.edu.cn/showproblem.php?pid=6108 (2017"百度之星 ...
- linux运维、架构之路-K8s数据管理
一.Volume介绍 容器和Pod是短暂的,它们的生命周期可能很短,会被频繁的销毁和创建,存在容器中的数据会被清除,为了持久化保存容器的数据,k8s提供了Volume.Volume的生命周期独立于容器 ...
- 技巧:在 C/C++中如何构造通用的对象链表[转]
原文:技巧:在 C/C++中如何构造通用的对象链表 虚拟链表和类链表可以很好地实现这一点 您是否做过这样一个项目,它要求您在内存中保存数目不定的若干不同对象?对于某些情况,二叉树是最佳选择,但在通常情 ...
- vue-property-decorator知识梳理
仓库地址: /* npm 仓库地址 */ // https://www.npmjs.com/package/vue-property-decorator /* github地址 */ // https ...
- PHP-过滤器-连接数据库-解析XML
PHP 过滤器 what? PHP 过滤器用于验证和过滤来自非安全来源的数据,比如用户的输入. 验证和过滤用户输入或自定义数据是任何 Web 应用程序的重要组成部分. 设计 PHP 的过滤器扩展的目的 ...
- elasticsearch 单实例安装启动
elasticsearch 初次启动 下载 elasticsearch-6.3.2.tar.gz 创建目录 /usr/local/elasticsearch/ 解压 tar -zxf elastics ...
- spark streaming 5: InputDStream
InputDStream的继承关系.他们都是使用InputDStream这个抽象类的接口进行操作的.特别注意ReceiverInputDStream这个类,大部分时候我们使用的是它作为扩展的基类,因为 ...
- python3 格式化输出,字符串操作,模块,列表,元组
初识python,在网上看了老男孩的视频,建立一个博客将自己所学的python知识记录下来. input加密,用于输入密码的阶段. import getpass user = input(" ...
- 一、基础篇--1.2Java集合-HashMap死循环问题
为什么HashMap会出现死循环 首先,我们知道java的HashMap不是线程安全的.多线程下应该使用ConcurrentHashMap. HashMap底层是基于动态数组和单向链表(JDK1.7, ...
- spring boot配置redis