Is there a best practice concerning the nesting of label
and input
HTML elements?
classic way:
I prefer
over
Mainly because it makes the HTML more readable. And I actually think my first example is easier to style with CSS, as CSS works very well with nested elements.
But it's a matter of taste I suppose.
If you need more styling options, add a span tag.
Code still looks better in my opinion.