【发布时间】:2018-07-29 22:59:33
【问题描述】:
是否可以仅使用 css 设置样式,即没有标签的单选按钮?带有标签的单选按钮似乎看起来不错,但没有标签的单选按钮根本不会出现。没有通过互联网找到任何适合我的问题的解决方案。
http://codepen.io/anon/pen/iJjru/
input.form-radio:empty{
margin-left: -9999px}
input.form-radio:empty ~ .description {
position: relative;
float: left
text-indent: 30px
margin-top: 0 }
input.form-radio:empty ~ .description:before {
position: absolute
display: block
top: 3px
bottom: 0
left: 0
content: ''
width: 10px
height: 10px
background: #fff
border-radius: 30px
border: 2px solid #fdd68d }
input.form-radio:hover:not(:checked) ~ .description.option:before {
text-indent: .9em
color: #C2C2C2
background-color: orange }
input.form-radio:hover:not(:checked) ~ .description {
color: #888 }
input.form-radio:checked ~ .description:before {
text-indent: .9em
background-color: orange }
input.form-radio:checked ~ .description {
color: #777}
【问题讨论】:
-
你想应用什么样的样式?
-
向我们展示您的尝试
-
一个说明问题的例子会有很大帮助
-
也许一些代码会有所帮助
-
我尝试用单选按钮包装的类更改标签,出现了复选框,但它们不可点击。