4
I was taking a look at the tutorial from W3schools, where he’s teaching to use the input
of the kind checkbox
in Bootstrap.
According to one example, I saw the following code::
<div class="checkbox">
<label><input type="checkbox" value="">Option 1</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="">Option 2</label>
</div>
<div class="checkbox disabled">
<label><input type="checkbox" value="" disabled>Option 3</label>
</div>
I had never used label
with some input
inside, because I thought it was more logical to use the label
to identify what the input
makes, side by side. But now that I’ve seen it on W3schools and the Bootstrap website itself teaches to do by placing the input
within the label
.
So far I’ve only seen this example with checkbox
, but I have some doubts
My question is:
Wouldn’t that be incorrect? Because that sounds like putting one
input
within ah1
?Whichever
input
can be placed inside alabel
? Or just thecheckbox
? Or is that fashion invention bootstrap?If this is valid, it is valid only for HTML 5, or for other versions according to W3c?
note: I didn’t add the tab bootstrap, because the question is not on that subject, it is just a quote
You already have two problems face, 1st - W3schools only serves to learn the basics, not as a rule (they teach to stack the blocks, it doesn’t mean they are stacked right). 2º - Bootstrap is practically a gambiarra for you to leave the site "cute" when you do not have time to make decent design.
– Guilherme Lautert
You can check if a hmtl document is valid in the W3 validator. I put yours there
html
and it is valid.– Bruno Costa