Good accessibility usually starts with clear words and the right HTML elements, not a large amount of extra code.
What You Need to Know
High-contrast settings may replace your carefully chosen colors. Make sure the meaning of a warning or selected state is not conveyed by color alone, and keep native controls understandable.
Try the Example
Take a look at the example. We’ll explain the important lines right below it.
<main>
<h1>Homework tasks</h1>
<p><strong>Due today:</strong> Finish the HTML exercise.</p>
<button type="button">Mark complete</button>
</main>
Let’s Read the Code
- <main>: The main element marks the primary page content.
- <h1>: A top-level heading explains what the page is about.
- type: Type changes what sort of control or resource the browser uses.
What the example shows: Clear text labels and native buttons remain meaningful even when a browser overrides colors for high-contrast modes.
What Happens in the Browser?
Try this with Tab and Shift+Tab. If you can, inspect the accessibility tree too; appearance alone does not tell the whole story.
Try a different way of reading. Read only the headings and labels, or navigate through links without looking at the rest of the page. If the page still makes sense, the underlying HTML is probably doing an important part of its job.
Your Turn
Switch the operating system to a high-contrast theme and check whether the action remains clear.
Common Beginner Mistakes
- Judging the page only by how it looks, without checking its meaning and keyboard behavior.
- Do not communicate status only through a green or red background.
Key Takeaways
- High-contrast settings may replace your carefully chosen colors.
- <main>: The main element marks the primary page content.
- Test the behavior you expect rather than trusting how the snippet looks in your editor.