Preparing your workspace
Accessible HTML gives users meaningful structure, labels, names, and relationships so people with different abilities can understand and interact with a page.
Accessibility starts with correct HTML. Use semantic elements whenever possible because they communicate meaning to assistive technologies. Give form controls clear labels. Use headings in a logical structure instead of choosing headings only for font size. Provide useful alternative text for meaningful images. Make links and buttons descriptive so users can understand their purpose. Native HTML controls such as button, input, select, and a are usually better than recreating the same behavior with generic div elements. Keyboard users should be able to move through interactive content in a predictable way. Accessibility is not a separate feature added at the end; it should be part of how HTML is written from the beginning.
A login page should provide labeled email and password fields, a real submit button, meaningful error messages, and a logical heading structure.
<main>
<h1>Sign In</h1>
<form>
<div>
<label for="email">Email address</label>
<input id="email" name="email" type="email" autocomplete="email" required>
</div>
<div>
<label for="password">Password</label>
<input id="password" name="password" type="password" autocomplete="current-password" required>
</div>
<button type="submit">Sign In</button>
</form>
</main>The browser displays a clearly structured sign-in form that provides meaningful labels and native controls.