Studying I saw some code examples where input
is placed inside label
, this brought me a doubt, would it be semantic to use what elements within a label
?
<label for="campo">Descritivo do campo
<input type="text" id="campo" />
</label>
Should the <label>
tag be just to provide a descriptive of the following field?
In terms of accessibility, can I use title elements type H2
or H3
within a label
? Semantically this seems wrong ... I keep imagining the screen reader finding a title h2
within a label
<label for="campo">
<h2>título do campo</h2>
<input type="text" id="campo" />
</label>
What would be the right thing to use inside the label?
What would be valid for W3C or WCGA?