赞
踩
1.在原生的单选框如何用css修改默认样式呢
2.html代码
- <form>
- <input type="radio" name="option" value="option1" id="option1">
- <label for="option1">最小化到托盘</label><br>
- <input type="radio" name="option" value="option2" id="option2" checked>
- <label for="option2">关闭应用</label><br>
- </form>
3.css代码
- /*重写伪类*/
- input[type="radio"]+label::before {
- content: " ";
- display: inline-block;
- vertical-align: middle;
- width: 13px;
- height: 13px;
- border-radius: 50%;
- border: 1px solid #999999;
- margin-right: 0.2rem;
- box-sizing: border-box;
- margin-top: -0.1rem;
- }
-
- input[type="radio"]:checked+label::before {
- background-color: #d73c3a;
- background-clip: content-box;
- border: 1px solid #d73c3a;
- padding: 0.1rem;
- box-sizing: border-box;
- }
- input[type="radio"] {
- position: absolute;
- clip: rect(0, 0, 0, 0);
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。