工作不相邻的兄弟选择我有这样的代码: HTML:在Mozilla Firefox 39.0.3
<label>
<input class="checkable" type="checkbox" value="6" name="Peak">
<button class="button">1</button>
</label>
<label>
<input class="checkable" type="checkbox" value="12" name="Peak">
<button class="button">2</button>
</label>
CSS:
label > .checkable{
display:none;
}
label > .checkable + button{
cursor:pointer;
margin:1px;
border-radius: 16px;
border:transparent;
width:32px;
height:32px;background: rgba(0,0,0,0);
}
label > .checkable:checked + button{
background-color:#690b0c;
color:white;
border-radius: 16px;
}
我结合复选框与元素。当你点击其中一个按钮时,他们应该会看到一个红色的圆形背景。这在IE 11中按预期工作,但在Firefox的最新版本中似乎存在一些问题。 任何人都有解决这个问题吗?
小提琴:https://jsfiddle.net/jjqg5apa/
似乎并没有在Chrome浏览器工作,要么。 –
在Firefox 37 –
没有工作嗯...这不是选择......它的工作原理,如果'显示:none'被删除。 –