为了对齐目的,我需要输入单选元素+关联的文本具有相同的宽度。我尝试了这个:
.rad {
width: 80px;
}
...但这仅适用于无线电元素本身(使它们处于空白的海洋中)。
所以我尝试了这个:
.rad text {
width: 160px;
}
...但是它什么也没做。
用于样式设置的html是:
<input type="radio" class="rad" id="visitor" name="travelertype" />Visitor
<input type="radio" class="rad" id="ucstudent" name="travelertype"/>UC Student
<input type="radio" class="rad" id="ucemployee" name="travelertype"/>UC Employee
尝试答案,我得到:
您需要更改标记以实现此目的。有很多方法,这里是其中的两种。
<table>
<tr>
<td>
<input type="radio" class="rad" id="visitor" name="travelertype" />Visitor
</td>
<td>
<select ...>
</td>
</tr>
... and so on.
</table>
<label>
s并在标签中添加样式<input type="radio" class="rad" id="visitor" name="travelertype" /><label for="travelertype" class="label-radio">Visitor</label>
CSS:
label.label-radio {
width: 100px;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句