【问题标题】:Checked radio button style sibling label选中的单选按钮样式同级标签
【发布时间】:2015-06-04 22:20:38
【问题描述】:

I working on some functionality at the moment, that mask a radio input to look like coloured square, when a radio is selected the sibling label background should change colour, what is happening though is whatever radio button I check, the first label总是变色,这是我的小提琴,

http://jsfiddle.net/heZBT/3622/

我认为这段代码足以进行正确的标签更改,

input:checked + label {
   background:yellow;
}

我尝试的一切只会在选中任何单选时使第一个单选兄弟标签变为黄色。

【问题讨论】:

    标签: html css radio-button


    【解决方案1】:

    您的标签/按钮具有相同的idfor 属性。更改它们并按预期工作:http://jsfiddle.net/bfehyv2a/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-25
      • 2015-08-14
      • 2013-01-13
      • 2018-08-15
      • 2014-04-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多