我在自定义Foundation 4表单中遇到了这个完全愚蠢的问题。使用单选按钮制作css切换(使用Foundation 4)
我想要的是一个纯粹的CSS切换,您可以在“销售”和“租金”之间切换。他们需要是radio buttons
,但我不希望他们看起来像那样,所以我试图按照this example来隐藏inputs
并使labels
看起来像links
那样简单。
标记是这样的:
<form class="custom">
<input type="radio" name="switchRadio" id="sale" value="sale" checked="" class="no-custom">
<label for="sale">Sale</label>
<input type="radio" name="switchRadio" id="rent" value="rent" class="no-custom">
<label for="rent">Rent</label>
<!--more form elements-->
</form>
我知道,在基金会自定义表单默认的标记是有嵌套在标签内的input
,但因为我不能,我不能这样做的t针对一个检查input
家长与CSS,但我可以针对其兄弟。
我已经添加了no-custom
类,因为作为输入不可见,我不需要它们是漂亮的。
因此,出于一些奇怪的原因,label for="sale"
工作正常,点击标签检查input id="sale"
,但点击label for="rent"
也检查input id="sale"
。任何想法为什么?