A
A
Alexey Nikolaev2016-04-21 15:37:03
HTML
Alexey Nikolaev, 2016-04-21 15:37:03

Does the association between label and input affect SEO/semantics?

Good day.
Is it worth additionally binding label and input using the for attribute and, accordingly, id? Would there be any difference compared to having the label and input separate from each other in a regular div? Code examples:

<div>
    <label>Label</label>
    <input />
</div>

<div> <!-- Вариант со связыванием, "правильный" -->
    <label for="input1">Label</label>
    <input id="input1" />
</div>

The question, first of all, is relevant for those cases when the usability is not affected by the link in any way (for example, instead of an input - select, the focus on which gives nothing), and when it is also impossible to wrap the input in a label - for example, we have a group of checkboxes or radio switches.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2016-04-21
@healqq

In order not to bind, you can also do this:

<label>
    label text 
    <input type='any'/>
</label>

It is worth putting bindings at least for the sake of convenience. This is especially true for checkboxes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question