3 ms·
On the inputs.. for radio/checkbox, I prefer to wrap inside the label element. <label> <input ... /> <span>Some text...</span> </label> Wh
by tracker1 2y ago
On the inputs.. for radio/checkbox, I prefer to wrap inside the label element.
<label>
<input ... />
<span>Some text...</span>
</label>
When you do it this way, the label doesn't need to be mapped to the id for the input, it's implicit. Also, it allows easier adjustments to the characteristics of the checkbox/radio input via CSS.
You do want an inner <span> if you want to stylize the input control as an inline-block depending on your needs. For general use, with the native controls, the inner span isn't necessary, I still prefer it by convention.