Using CSS4 you can do this:
!label /for/ input[type="text"]:focus, !label input[type="text"]:focus { ... }
The first allows you to use <label for="inputid"> , and the second for <label><input type="text"/></label>
However, CSS4 support is extremely limited. However, there is no harm in its placement.
source share