Is there a form element meant to provide instruction?

Question

I know how to add labels to form inputs to 'label' what they are. I am wondering if there is something similar for describing what a field is in more details? I want to there to be little text under a text field but don't know if there is a specific element I should use... thanks!

Answer

As you've already mentioned, each input requires that it has a corresponding label. If you would like to include some text below a form field to help describe that input, you'll need to use the aria-describedby attribute. An example would look like this:

<form>

<label for="input1_1">Given Name</label>

<input id="input1_1" required autocomplete="given-name" aria-describedby="input1_1_description">

<p id="input1_1_description">Enter your first name, or given name, in this field.</p>

</form>

Free Tools to Continue Learning

Accessible Web Company Logo

Accessible Web RAMP

Monitor your website and manage your progress towards WCAG conformance.

Accessible Web Company Logo

Accessible Web Academy

Career specific courses to help power up your accessibility knowledge.