html - CSS selector to bold only labels without child elements -
i have basic html form label
tags used define field names , label
tags used around checkboxes user clicking on text next checkbox selects checkbox.
<label>valid?</label> <label> <input type="checkbox" /> yes </label>
what css best practice field name bold ("valid?"), checkbox descriptor not bold?
i have tried several variations adding different :not
, :empty
, i'm not hitting right selector - either both bold or neither bold. know :empty isn't working since text element messes up, there must simple way bold labels have text elements.
label:empty { font-weight: bold; }
js fiddle: http://jsfiddle.net/z77tq8bs/
you can use next sibling selector, this:
label { font-weight: bold; } label + label { font-weight: normal }
check fiddle: https://jsfiddle.net/8cluhznb/
Comments
Post a Comment