【发布时间】:2016-05-13 07:50:55
【问题描述】:
我发现了一篇 SO 文章,该文章演示了如何将单选按钮更改为可点击按钮 here,这在 Chrome 和 Safari 中很有效。但是,Firefox 无法正确呈现 CSS。文章提到该解决方案在 IE 中不起作用,只是不确定这是否意味着它在 Firefox 中也不起作用。
https://jsfiddle.net/eqyms7vc/2/
HTML
<div id="service_type">
<input type="radio" name="service_type" id="service_type_1" value="Option 1">
<input type="radio" name="service_type" id="service_type_2" value="Option 2">
</div>
CSS
#service_type .container {
margin: 10px;
}
#service_type label {
padding: 6px 12px;
color: #fff;
}
#service_type input {
-webkit-appearance:none;
height:50px;
width:150px;
padding:10px;
color:white;
margin:5px;
font-size: 18px;
text-align: center;
}
#service_type input:hover {
font-weight: bold;
}
#service_type input#service_type_1 {
background:#336600;
}
#service_type input#service_type_2 {
background:#0066ff;
}
#service_type input#service_type_1:before, input#service_type_1::before {
content:"Option 1";
}
#service_type input:before, input::before {
line-height:30px;
width:100%;
text-align:center;
}
#service_type input#service_type_2:before, input#service_type_2::before {
content:"Option 2";
}
#service_type .selected {
background-color: #000;
}
如果无法让 Firefox 正确呈现上述 CSS,是否可以仅向 Firefox 浏览器显示单选按钮标签?
谢谢!
【问题讨论】:
-
感谢您的回复!不幸的是,这段 CSS 不能很好地与 Firefox 配合使用,所以我已经开始将它们转换为正确的按钮。