Back to HTML

What Semantic HTML Means and Why It Matters

Coding Tutorials Team 22 June 2026

Semantic HTML is one of those phrases everyone repeats and few people can justify concretely. It gets defended on grounds of cleanliness and best practice, which is unconvincing to anyone whose page already looks correct. The actual case is more specific than that.

What the word means here

A semantic element describes what its content is. A button element is a button, a navigation element contains navigation, a table contains tabular data. A non-semantic element describes nothing: a div is a generic block and a span is a generic inline box, and both are deliberately meaningless.

Writing semantic markup means choosing the element that already describes your content rather than reaching for a generic one and adding a class name. The class name is meaningful to you and to your stylesheet. It is meaningless to everything else that reads the page.

The accessibility tree

This is the mechanism behind most of the benefit. As well as the document tree, browsers build a second structure called the accessibility tree, which is what assistive technology actually reads.

Each node in that tree carries a role, a name, and a set of states. A button element produces a node with a button role, a name taken from its content, and states such as pressed or disabled. A div with a click handler produces a node with no role at all, which means a screen reader announces nothing useful and a user has no indication that the thing is interactive.

Every semantic element populates this tree for free. Reproducing the same information on a generic element requires role attributes, aria attributes, a tabindex, and keyboard handlers, all of which have to be maintained and any of which can be got wrong.

Navigation, not just announcement

Screen reader users do not generally read a page from top to bottom. They navigate it, jumping between headings, landmarks, links, form controls and tables.

Those jumps are only possible where the structure exists. A page built from divs offers nothing to jump between, so the only option is to listen through everything in order. On a long page with a large navigation menu, that is the difference between finding the content in two seconds and hearing forty links first.

Search engines read structure too

Crawlers use markup to work out what a page contains and which parts matter. Headings outline the content, the main element indicates the primary content as opposed to the furniture around it, and navigation regions are recognised as such.

The effect is real without being dramatic. Semantic markup will not rank a poor page well, and it helps a good page be understood correctly, which matters more as search results increasingly extract specific answers rather than listing documents.

Default behaviour you would otherwise write

Native elements arrive with behaviour attached. A button is focusable, responds to enter and space, and submits a form. A link is focusable, opens in a new tab on a modifier click, and can be copied and bookmarked. A checkbox toggles with the space bar and is announced with its state.

All of that is free and none of it is free when you build the same control from a div. The common shortcut of adding a click handler to a generic element produces something that works for a mouse user and fails silently for everyone else, and the fix is more code than simply using the right element would have been.

The maintenance argument

The last benefit is prosaic and worth stating. Markup that names what things are is easier to read six months later than markup where every element is a div distinguished only by a class.

Class names drift. They get renamed during a redesign, reused where they should not be, and accumulate meanings nobody documented. Element names cannot drift, because they mean what the specification says they mean.

Divs are not banned

This is worth saying clearly, because semantic markup is sometimes taken as a rule that generic elements are wrong. They are not.

A div is the correct element when you need a container purely for layout or styling and the grouping carries no meaning. Wrapping three sections in a div to make them a flex container is exactly what a div is for. The mistake is using one where a meaningful element exists, not using one at all.

Where to start

If a page is already built from generic elements, the highest value changes are small. Use real buttons and links for interactive things. Give the page a main element and wrap the navigation in a nav. Ensure the headings form a sensible outline. Those four changes cover most of the benefit, and each takes minutes.