如果选中复选框,突出显示标签 [英] Highlight label if checkbox is checked
本文介绍了如果选中复选框,突出显示标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当选中相应的复选框时,是否有非JavaScript方式更改标签的颜色?
Is there a non-javascript way of changing the color of a label when the corresponding checkbox is checked?
推荐答案
您有
<div>
<input type="checkbox" class="check-with-label" id="idinput" />
<label class="label-for-check" for="idinput">My Label</label>
</div>
您可以执行
.check-with-label:checked + .label-for-check {
font-weight: bold;
}
查看此工作。请注意,这将不适用于非现代浏览器。
See this working. Note that this won't work in non-modern browsers.
这篇关于如果选中复选框,突出显示标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文