Quantcast
Viewing all articles
Browse latest Browse all 39

Answer by Walter Rumsby for Highlight label if checkbox is checked

I like Andrew's suggestion, and in fact the CSS rule only needs to be:

:checked + label {   font-weight: bold;}

I like to rely on implicit association of the label and the input element, so I'd do something like this:

<label><input type="checkbox"/><span>Bah</span></label>

with CSS:

:checked + span {    font-weight: bold;}

Example: http://jsfiddle.net/wrumsby/vyP7c/


Viewing all articles
Browse latest Browse all 39

Trending Articles