01
Write an accessible login form with proper labels.
Show answer
Every input needs a label linked through for and id, the right input type and autocomplete hints:
<form action='/login' method='post'>
<label for='email'>Email</label>
<input id='email' name='email' type='email' autocomplete='email' required>
<label for='pwd'>Password</label>
<input id='pwd' name='password' type='password' autocomplete='current-password' required minlength='8'>
<button type='submit'>Log in</button>
</form>
Clicking a label focuses its input and screen readers read the label aloud.