【发布时间】:2013-06-07 03:07:57
【问题描述】:
我想自定义我的单选按钮,使其如下所示:
为此,我使用以下css和html
HTML:
<div class="buttonSlider">
<input type="radio" value=".."></input>
<input type="radio" value=".."></input>
<input type="radio" value=".."></input>
</div>
CSS:
.buttonSlider {
font-size: 250%;
background: #ccffdd;
}
.buttonSlider input[type="radio"] { /* don't show the radio check items */
display: none;
}
.buttonSlider label {
display:inline-block;
background-color:#ddd;
padding:4px 11px;
font-family:Arial;
font-size:16px;
}
.buttonSlider input[type="radio"]:checked + .buttonSlider label {
background-color:#bbb;
}
但是,当我将此 CSS 应用于单选按钮时,按钮不可见。
有人可以帮助并向我详细解释他/她的解释吗?我对 css 很陌生。
【问题讨论】:
-
display:none;是它们不显示的原因。 -
在你的例子中,没有什么是可见的,因为没有什么可显示的。将标签添加到示例中。
-
我在您的标记中没有看到任何标签?
标签: html css radio-button custom-controls radio-group