我可以让一个p+p相邻的选择器工作,但不是label+input。为什么会这样?
p+p { color: red; /* Works fine! */ } label+input { background-color: red; /* Doesn't work */ }
<p>Test</p> <p>Test</p> <br> <label>Test</label><input type='checkbox'>
https://jsfiddle.net/h16engzw/
不,事实上它是工作,但你没有使用正确的财产
label+input { background-color: red; /* Doesn't work */ }
在这段代码中你试图给出 background-color: red; 到 checkbox background-color 例如,如果您要尝试以下方法:
background-color: red;
checkbox
background-color
input { background-color: red; }
这也行不通。
label+input { height:70px; }
我希望你明白我的意思。 如果没有请尽管问。