input_radio_自定义样式
来源:互联网 发布:网络群众路线问责 编辑:程序博客网 时间:2024/06/09 17:51
自定义radio样式切换
原生使用方法:
<input type="radio" name="sex" id="sex-female" v-model="inputValue" value="female"><label for="sex-female"></label><input type="radio" name="sex" id="sex-male" v-model="inputValue" value="male"><label for="sex-male"></label>
- name:多个input定义同一个name值,构成单选效果。
- id:和label中for绑定使用,用于点击label时,input选中切换。
- value:存储input选中值
- v-model:vue中查看选中的value值。
切换自定义背景图片:
HTML:<div class="input-common-box"> <input type="radio" class="ques-input-common" name="sex" id="sex-male" value="male" v-model="testdata"> <label class="ques-input-replace" for="male"></label></div><div class="input-common-box"> <input type="radio" class="ques-input-common" name="sex" id="femal" value="2" v-model="testdata"> <label class="ques-input-replace" for="femal" ></label></div>SCSS:.input-common-box { width:24px; height:24px; display: flex; justify-content: center; align-items: center; cursor: pointer;}//外层div样式.ques-input-common { appearance: none; -webkit-appearance: none; outline: none; display:none}//input样式隐藏.ques-input-replace { width: 100%; height:100%;//高度和宽度定义了与外层div同步,也可与外层不同 display: inline-block; background:url("images/check_01.png") no-repeat; //用span样式替换input样式 background-size: contain;}.ques-input-common:checked +.ques-input-replace { background:url("images/check_02.png") no-repeat; //input选中状态图片 background-size: contain;}
阅读全文
0 0
- input_radio_自定义样式
- ProgressBar自定义漂亮样式样式
- 自定义样式View(一)--自定义CheckBox样式
- 自定义 ProgressBar 进度条 自定义样式
- 自定义 ProgressBar 进度条 自定义样式
- 自定义Dialog(自定义button样式)
- 自定义View,自定义Switch样式
- 自定义Blog样式
- 自定义 checkbox 样式
- 自定义ALERT样式
- 自定义select的样式
- WPF ScrollViewer 自定义样式
- 自定义css样式
- GridView自定义分页样式
- 自定义FCKEditor中的“样式”
- UltraWebGrid自定义分页样式
- 自定义鼠标样式
- GridView自定义分页样式
- Activity的生命周期
- Java优先队列初识
- Android中webview:软键盘弹出引起的各种不适
- 图形数据库总结之NoSQL
- Spring Boot -- Spring Data Jpa(5)
- input_radio_自定义样式
- Linux+Anaconda+ tensorflow + keras 安装+换源
- 一篇关于了解generatorConfig自动生成model,dao包的心路历程
- Vue-Router(三) 编程式导航
- eclipse中添加额外的jar包
- Lua table源码分析
- Python爬虫入门-利用scrapy爬取淘女郎照片
- 构建乘积数组
- 外设位宽为8、16、32时,CPU与外设之间地址线的连接方法