Engineering 4 min read Updated
Semantic HTML and why element choice matters
In short
Choose each element for the meaning it gives content, because screen readers, keyboards and search engines all read the structure you write.
Each element in your HTML tells browsers and assistive technology what a piece of content is. Screen reader users, keyboard users and search engines all rely on that meaning, not on how the page looks. Choose elements for their meaning first and for their looks second. Start by checking the structure of a page you have already built.
Meaning, not appearance
MDN defines semantics as the meaning of a piece of code. A semantic element gives its content a role. An h1 element, for example, gives the text it wraps the role of a top-level heading on the page. MDN says HTML should represent the data it contains rather than its default presentation, and that presentation is the sole responsibility of CSS.
Compare a span styled to look like a title. It can look exactly like a top-level heading, yet MDN says it “has no semantic value, so it will not get any extra benefits.” Styling can make a heading look right, but only the element makes it a heading.
Landmarks and headings form the outline
The W3C Web Accessibility Initiative asks you to identify and mark up regions of a page using HTML5 and WAI-ARIA roles. Labelled regions let people tell the parts of a page apart and move between them. Some browser plugins use landmark roles to jump straight to a section.
Headings label sections and should be nested logically, so that their levels reflect how the sections relate to each other. The W3C page does not set rules for heading levels or their order, so use a practical test: read only the headings in sequence, and the outline should describe the page.
A button and a link are not interchangeable
A button is an interactive element that performs an action, such as submitting a form or opening a dialog. MDN notes that users can activate it with a mouse, keyboard, finger, voice command or other assistive technology.
One default causes trouble. A button inside a form submits that form unless its type says otherwise. MDN says a button that does not submit form data should have its type set to button, because otherwise it may try to submit data and damage the current state of the document.
The sources do not say when to use a button and when to use a link. A simple working convention settles it: a link takes the reader to another place, and a button performs an action on the current page. Apply the same convention across the whole site.
Working on something similar in your own product? A few honest sentences are enough – we read every enquiry and reply by email. Apply with your idea
Choosing the right element
The table gives a quick reference for the elements that cause the most mistakes.
| Job | Use | Avoid |
|---|---|---|
| Section title | A heading element, nested by level | Styled text that only looks like a heading |
| Action on this page | A button, with its type set correctly | A link that changes data |
| Going to another page or place | A link | A button used only for navigation |
| Group of related items | A list | Lines separated by line breaks |
| Styling hook with no meaning | A generic container such as a div or a span | Any element that already has a meaning |
Check the structure in this order
- Read only the headings, in order. The outline should describe the page without the surrounding layout.
- Check that each section has one heading at the right level, and that no heading is used only to make text bigger.
- Tab through the page. Every control should be a button or a link with a clear name. Keyboard testing needs its own steps, described in the article on keyboard accessibility.
- Check that every button that does not submit a form has its type set to button.
- Confirm that the page declares its language, and that images which carry information have text alternatives, as explained in the article on alternative text.
Then run the wider checks described in how to test a service for accessibility, because a structural check does not replace testing with people.
Who benefits from a sound structure
The W3C page lists the people who gain from well-structured content. Screen reader users can skip to the main content and jump between sections. Keyboard users avoid pressing Tab through every link in each section. People who use reader modes see only the main content when the page is marked up correctly. People with cognitive disabilities can find and prioritise content more easily. Search engines can also use the structure to index content more effectively.
The sources set no rules for buttons versus links, or for lists. The convention and the table above are working advice, not a standard.
Common questions
- Does semantic HTML change how a page looks?
- Not by itself. MDN says presentation is the sole responsibility of CSS, so you can restyle a heading without changing its element.
- Should I use a button or a link?
- Use a link to take the reader to another place, and a button to perform an action on the current page. The sources do not set this as a rule, so treat it as a working convention.
- Does semantic markup help search engines?
- The W3C page says search engines can use this structure to index content more effectively. It does not promise a better ranking.
Sources
- Semantics, MDN Web Docs. Accessed 24 November 2026
- HTML button element, MDN Web Docs. Accessed 24 November 2026
- Page Structure Tutorial, W3C Web Accessibility Initiative. Accessed 14 November 2026
Further reading
-
Alternative text for three kinds of image
Alternative text must serve the same purpose as the image, so informative images get a description, functional images describe their action, and decorative images get an empty value.
-
What keyboard accessibility asks for in WCAG 2.2
Every function must work from the keyboard, timing must not decide the result, and repeated blocks need a way to be bypassed.
-
Progressive enhancement in practice: HTML first
Build the page so the main task works with HTML alone, then add CSS and JavaScript as improvements that never block the baseline.
Have an idea that should exist? Or a working product that needs more customers, a new website or a complete rework? Bring us anything. Apply with your idea