HTML Semantic HTML: Accessibility Review
Before we call a page finished, let’s review it from the learner’s side. Semantic markup makes a page predictable for keyboard users, screen-reader users, reader mode, slow connections, and the future developer who must safely change it.
We are building a page another person can understand without our help. That means the HTML must communicate structure before CSS, JavaScript, analytics, or a component framework enters the picture.
What We Will Practise Together
Use native HTML first. A button should perform an action, a link should navigate, alternative text should carry an image’s useful information, and a page should reveal one clear central task.
- Name the purpose before choosing the element.
- Test the keyboard or reading order after writing it.
- Keep visual layout classes separate from document meaning.
A small honest page is more valuable than a large page of copied tags. We will use each example as a decision we can explain, test, and reuse.
Example 1: Use a button for an action
Let’s work through this decision slowly. Use a button for an action is useful because it gives the document a truthfully named boundary rather than a visual box with hidden meaning.
First identify the element and its owner. Next predict what a learner can do with it. Finally, change one attribute or heading and explain whether the meaning remains honest. This is how we turn tag knowledge into a dependable engineering habit.
HTML
<button type="button" aria-expanded="false">Show semantic HTML hint</button>
<a href="/html/forms">Study HTML Forms</a>Expected Result
The action is a button; the destination is a link.
Teacher check: do not merely copy the tag. State the learner impact in one sentence before you keep it in a production page.
Example 2: Write useful alternative text
Let’s work through this decision slowly. Write useful alternative text is useful because it gives the document a truthfully named boundary rather than a visual box with hidden meaning.
First identify the element and its owner. Next predict what a learner can do with it. Finally, change one attribute or heading and explain whether the meaning remains honest. This is how we turn tag knowledge into a dependable engineering habit.
HTML
<img src="/divider.svg" alt="">
<img src="/landmarks.svg" alt="Diagram showing header, nav, main, aside, and footer regions">Expected Result
The divider is skipped; the diagram is described with useful information.
Teacher check: do not merely copy the tag. State the learner impact in one sentence before you keep it in a production page.
Example 3: Keep one main region
Let’s work through this decision slowly. Keep one main region is useful because it gives the document a truthfully named boundary rather than a visual box with hidden meaning.
First identify the element and its owner. Next predict what a learner can do with it. Finally, change one attribute or heading and explain whether the meaning remains honest. This is how we turn tag knowledge into a dependable engineering habit.
HTML
<header>AlgoGalaxy</header>
<nav aria-label="Primary">...</nav>
<main><h1>Semantic HTML review</h1></main>
<footer>Support resources</footer>Expected Result
There is one obvious destination for a jump-to-main command.
Teacher check: do not merely copy the tag. State the learner impact in one sentence before you keep it in a production page.
Example 4: Explain embedded media
Let’s work through this decision slowly. Explain embedded media is useful because it gives the document a truthfully named boundary rather than a visual box with hidden meaning.
First identify the element and its owner. Next predict what a learner can do with it. Finally, change one attribute or heading and explain whether the meaning remains honest. This is how we turn tag knowledge into a dependable engineering habit.
HTML
<figure>
<video controls><source src="/semantic-html.mp4" type="video/mp4"></video>
<figcaption>Landmark walkthrough. <a href="/transcripts/semantic-html">Read transcript</a></figcaption>
</figure>Expected Result
The media has a topic, caption, and transcript route.
Teacher check: do not merely copy the tag. State the learner impact in one sentence before you keep it in a production page.
Example 5: Run a concrete checklist
Let’s work through this decision slowly. Run a concrete checklist is useful because it gives the document a truthfully named boundary rather than a visual box with hidden meaning.
First identify the element and its owner. Next predict what a learner can do with it. Finally, change one attribute or heading and explain whether the meaning remains honest. This is how we turn tag knowledge into a dependable engineering habit.
HTML
<main>
<h1>Semantic HTML checklist</h1>
<ul><li>One main region</li><li>Logical headings</li><li>Clear links</li><li>Real buttons</li></ul>
</main>Expected Result
A learner can test four specific semantic HTML checks.
Teacher check: do not merely copy the tag. State the learner impact in one sentence before you keep it in a production page.
Teacher’s Review
Now review the page as a learner would. Can you reach main quickly? Does every heading describe a real topic? Does every control have the native behavior its label promises?
- Read the heading outline without using font size.
- Tab from the first interactive element into the lesson.
- Replace one vague div, link, or heading with the element that states the real intent.
Semantic HTML is not extra decoration for accessibility. It is the clearest explanation of the document we are already trying to build.
Example 6: Make the input visible
Start by naming the value the next line depends on. This keeps the lesson input explicit before we apply a transformation or call an external boundary. We are applying that habit while revisiting HTML Semantic HTML: Accessibility Review.
Keep the example small enough to trace. First predict the normal result; then change one input and explain the boundary result in your own words.
HTML
<label for="lesson-7">HTML Semantic HTML Accessibility Review</label>
<input id="lesson-7" name="lesson" value="HTML Semantic HTML Accessibility Review" />
<p id="result-7">Ready to practice</p>Expected Result
A labelled input and a readable result are rendered.
Try next: Replace the sample value with one from your own notes, predict the result, and then run it.
Example 7: Guard an empty boundary
A small guard makes the allowed and rejected path visible. We want a caller to receive an intentional result instead of discovering an unexplained failure later. We are applying that habit while revisiting HTML Semantic HTML: Accessibility Review.
Keep the example small enough to trace. First predict the normal result; then change one input and explain the boundary result in your own words.
HTML
<label for="lesson-8">HTML Semantic HTML Accessibility Review</label>
<input id="lesson-8" name="lesson" value="HTML Semantic HTML Accessibility Review" />
<p id="result-8">Ready to practice</p>Expected Result
A labelled input and a readable result are rendered.
Try next: Try an empty value as well as the normal value and describe why the two outcomes differ.
Example 8: Keep the transformation pure
This step returns a value instead of mixing the rule with display or storage work. That separation gives us a small unit we can run, test, and reuse. We are applying that habit while revisiting HTML Semantic HTML: Accessibility Review.
Keep the example small enough to trace. First predict the normal result; then change one input and explain the boundary result in your own words.
HTML
<label for="lesson-9">HTML Semantic HTML Accessibility Review</label>
<input id="lesson-9" name="lesson" value="HTML Semantic HTML Accessibility Review" />
<p id="result-9">Ready to practice</p>Expected Result
A labelled input and a readable result are rendered.
Try next: Call the same rule twice with different inputs and confirm that each result depends only on its input.
Example 9: Make a branch deliberate
Use a named branch where the business rule changes. A future reader should be able to point at the condition and state the result for both sides. We are applying that habit while revisiting HTML Semantic HTML: Accessibility Review.
Keep the example small enough to trace. First predict the normal result; then change one input and explain the boundary result in your own words.
HTML
<label for="lesson-10">HTML Semantic HTML Accessibility Review</label>
<input id="lesson-10" name="lesson" value="HTML Semantic HTML Accessibility Review" />
<p id="result-10">Ready to practice</p>Expected Result
A labelled input and a readable result are rendered.
Try next: Change the boundary value by one and explain exactly which branch becomes active.
Example 10: Use a collection without hidden mutation
Collections become safer when we can see which value is read, which value is derived, and whether the original collection remains owned by the caller. We are applying that habit while revisiting HTML Semantic HTML: Accessibility Review.
Keep the example small enough to trace. First predict the normal result; then change one input and explain the boundary result in your own words.
HTML
<label for="lesson-11">HTML Semantic HTML Accessibility Review</label>
<input id="lesson-11" name="lesson" value="HTML Semantic HTML Accessibility Review" />
<p id="result-11">Ready to practice</p>Expected Result
A labelled input and a readable result are rendered.
Try next: Add one more item and predict the derived result before executing the code.
Example 11: Return a named outcome
A named outcome is easier to test than an implied side effect. We can now distinguish a successful path from a rejected path without guessing from console noise. We are applying that habit while revisiting HTML Semantic HTML: Accessibility Review.
Keep the example small enough to trace. First predict the normal result; then change one input and explain the boundary result in your own words.
HTML
<label for="lesson-12">HTML Semantic HTML Accessibility Review</label>
<input id="lesson-12" name="lesson" value="HTML Semantic HTML Accessibility Review" />
<p id="result-12">Ready to practice</p>Expected Result
A labelled input and a readable result are rendered.
Try next: Rename the outcome in your own words while preserving the same success and failure rule.
Example 12: Trace a small loop
Work through one value at a time. The point is not to memorize syntax; it is to see how the accumulator or output changes after each repeatable step. We are applying that habit while revisiting HTML Semantic HTML: Accessibility Review.
Keep the example small enough to trace. First predict the normal result; then change one input and explain the boundary result in your own words.
HTML
<label for="lesson-13">HTML Semantic HTML Accessibility Review</label>
<input id="lesson-13" name="lesson" value="HTML Semantic HTML Accessibility Review" />
<p id="result-13">Ready to practice</p>Expected Result
A labelled input and a readable result are rendered.
Try next: Use a shorter collection first, then add one value and trace the extra iteration aloud.
Example 13: Keep display at the edge
The core rule prepares a value, while the outer line decides how to show it. That keeps the result usable by a UI, test, API, or command-line caller. We are applying that habit while revisiting HTML Semantic HTML: Accessibility Review.
Keep the example small enough to trace. First predict the normal result; then change one input and explain the boundary result in your own words.
HTML
<label for="lesson-14">HTML Semantic HTML Accessibility Review</label>
<input id="lesson-14" name="lesson" value="HTML Semantic HTML Accessibility Review" />
<p id="result-14">Ready to practice</p>Expected Result
A labelled input and a readable result are rendered.
Try next: Change only the display text and verify that the underlying rule and result stay unchanged.
Example 14: Test the closest boundary
A useful example includes the nearest boundary, not only the happy path. We are making the behavior inspectable before a real caller relies on it. We are applying that habit while revisiting HTML Semantic HTML: Accessibility Review.
Keep the example small enough to trace. First predict the normal result; then change one input and explain the boundary result in your own words.
HTML
<label for="lesson-15">HTML Semantic HTML Accessibility Review</label>
<input id="lesson-15" name="lesson" value="HTML Semantic HTML Accessibility Review" />
<p id="result-15">Ready to practice</p>Expected Result
A labelled input and a readable result are rendered.
Try next: Try the lowest supported value and then one value just outside the accepted range.
Example 15: Write a tiny regression check
A compact assertion turns the lesson into a repeatable promise. It helps us catch a changed rule before a larger program hides the source of the mistake. We are applying that habit while revisiting HTML Semantic HTML: Accessibility Review.
Keep the example small enough to trace. First predict the normal result; then change one input and explain the boundary result in your own words.
HTML
<label for="lesson-16">HTML Semantic HTML Accessibility Review</label>
<input id="lesson-16" name="lesson" value="HTML Semantic HTML Accessibility Review" />
<p id="result-16">Ready to practice</p>Expected Result
A labelled input and a readable result are rendered.
Try next: Deliberately change the expected value once, observe the failed check, and then restore the correct contract.
Practice Before You Move On
Open one page you already own and sketch its header, navigation, main task, supporting material, and footer. Then compare that sketch with its source. Each mismatch gives you one focused improvement to make.
When you can explain why an element exists, who owns it, and what a learner experiences through it, you are designing a dependable document instead of copying HTML.
