纯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 ...
随机推荐
- (转发)Android 源码获取-----在Windows环境下通过Git得到Android源代码
在学习Android的过程中,深入其源代码研究对我们来说是非常重要的,这里将介绍如何通过在Windows环境下使用Git来得到我们的Android源代码. 1.首先确保你电脑上安装了Git,这个通过 ...
- js 密码为空显示错误
<script> var user = document.getElementById("user"); var pwd = document.getElementBy ...
- TCP层sendmsg系统调用的实现分析
概述 sendmsg系统调用在tcp层的实现是tcp_sendmsg函数,该函数完成以下任务:从用户空间读取数据,拷贝到内核skb,将skb加入到发送队列的任务,调用发送函数:函数在执行过程中会锁定控 ...
- vue-cli脚手架构建了项目,想去除Eslint验证,如何设置?
vue-cli脚手架构建了项目,想去除Eslint验证,如何设置? 在webpack.base.conf.js里面删掉下面: preLoaders: [ { test: /\.vue$/, loade ...
- 20191114-3 Beta阶段贡献分配
此作业要求参见:https://edu.cnblogs.com/campus/nenu/2019fall/homework/10006 要求1 每位组员的贡献分值 贺敬文:10 王志文:9 彭思雨:8 ...
- yum 时一直停在Determining fastest mirrors 界面
[root@fanyk ~]# yum redis Loaded plugins: fastestmirror Determining fastest mirrors 在yum makecache时, ...
- python 面对对象 类(继承, 多态)
继承,继承其它实例化样本的属性和方法,需要在声明里重新定义和使用 class School(object): def __init__(self, name, addr): self.name = n ...
- CAD二次开发中各类多段线的dxf组码
Document doc = Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; ed.WriteMessag ...
- SVN服务器的安装
运行VisualSVN-Server-2.7.3.msi程序, 如下图 点击Next, 下一步 选中 I accept选项, 点击Next, 下一步 选择默认配置, 服务和控制台组件方式, 点击Nex ...
- Collapse 折叠面板
通过折叠面板收纳内容区域 基础用法 可同时展开多个面板,面板之间不影响 <el-collapse v-model="activeNames" @change="ha ...