在本教程的帮助下,我自定义了我的单选按钮。
现在我正在尝试在单选按钮旁边添加文本,但我无法用我所拥有的这种结构真正弄清楚。
有任何想法吗?
HTML:
<fieldset>
<div class="radioButton">
<input type="radio" name="x" value="y" id="y" />
<label for="y"></label>
</div>
<div class="radioButton">
<input type="radio" name="x" value="z" id="z" />
<label for="z"></label>
</div>
</fieldset>
CSS:
input[type=radio] {
visibility: visible; }
.radioButton {
width: 22px;
height: 22px;
background: #dedede;
margin: 20px 0px;
border-radius: 100%;
position: relative; }
/* Create the radio button */
.radioButton label {
display: block;
width: 18px;
height: 18px;
border-radius: 100px;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-o-transition: all .5s ease;
-ms-transition: all .5s ease;
transition: all .5s ease;
cursor: pointer;
position: absolute;
top: 2px;
left: 2px;
z-index: 1;
background: white; }
/* Radio button checked state */
.radioButton input[type=radio]:checked + label {
background: #77a942; }
/*