What is semantic HTML?
Semantic HTML uses elements for what content is, not how it should look: main, article, nav, h1 to h6, ul, table, instead of a div with a class. The browser draws the same pixels, but screen readers, search crawlers and AI agents get the structure, so they can find the main content, the headings and the section to edit.
Part of Glossary: the terms behind MCP, coding agents and shared pages, defined plainly.
Pick the element by asking what the content is: a heading, a list, a navigation block, an article. MDN's rule is the right element for the right job.
Wrap the page once in main, put repeated chrome in header, nav and footer, and give every section a heading so the outline reads like a table of contents.
Keep appearance in CSS. An h2 styled small is still a heading; a span styled large is still not one, and only a sighted person can tell the difference.
Use div and span only when no element fits, such as a layout wrapper. They carry no meaning, so every non-human reader skips past them.
Check it without the styling: a screen reader's landmark list, reader mode, or an agent asked to summarise the page should all find the same parts.
Source: MDN Web Docs: Semantics
Semantic HTML versus div soup
MDN defines semantics as the meaning of a piece of code: what role an element has, rather than what it looks like. An h1 gives its content the role of a top-level heading. A span with a 32px font looks identical in a browser but, as MDN puts it, has no semantic value, so nothing downstream treats it as a heading. The elements MDN lists as semantic include article, aside, details, figure, figcaption, footer, header, main, mark, nav, section, summary and time, alongside the headings, lists and tables that have always carried meaning.
The rules that matter in practice are few. main appears once per page, directly inside body. A section should start with a heading. nav is for blocks of navigation links, not every list of links. aside holds content only indirectly related to the page. div and span are the escape hatch for when nothing fits, such as a wrapper that exists only for layout, and MDN warns that they are so convenient they end up cluttering the whole document.
Example: a page an agent wrote
Coding agents produce HTML quickly, and the default output is often nested divs with utility classes. It renders fine. The trouble starts when a second agent, or the same one a week later, is asked to add a row to the pricing table. With table, thead and th in place the instruction is unambiguous. With a grid of divs it has to guess from class names, and class names are whatever the first agent felt like. The same goes for "update the FAQ section": an h2 that says FAQ, followed by a dl of terms and definitions, can be found by any program; a styled block cannot.
This is why a page an agent made should be semantic HTML even when no human will read the source. On a shared board, the HTML is read by every teammate's agent, so the tags are the interface between them.
Why it matters now
The audience for your markup has grown. Screen readers have always used headings and landmarks as signposts. Reader modes strip a page to its main and article. Search crawlers build an outline from the headings. AI crawlers convert HTML to text, and the llms.txt proposal describes exactly what goes wrong when they cannot: navigation, ads and scripts mixed into the content, tokens wasted on chrome. A converter that can keep main and drop nav produces clean text; one facing a wall of divs keeps everything.
Be honest about search, though. Google's SEO starter guide says Google Search can rarely depend on semantic meanings because so much of the web is invalid HTML, and that headings in order are good for screen readers rather than for ranking. Semantic HTML is not an SEO lever. It is the difference between a page that one program can render and a page that every program can read, summarise and change.
Common mistakes
- Choosing a heading level for its size. Use the level that fits the outline and resize it in CSS.
- More than one
main. Assistive tech expects a single main landmark; a second one makes the first meaningless. - A
sectionwith no heading. Readers that navigate by heading will skip the whole block. - Clickable
divs instead ofbuttonora. They look right and cannot be reached by keyboard or named by a screen reader. articleon everything. It is for content that stands alone, such as a post or a card. Usesectionfor parts of one piece.
FAQ
- Does semantic HTML improve SEO rankings?
- Less than people hope. Google's SEO starter guide says that because so much of the web is invalid HTML, Google Search can rarely depend on semantic meanings, and that headings out of order do not hurt. The gains are elsewhere: screen readers, reader modes, and programs that read or edit your page without a browser.
- Is semantic HTML the same as structured data?
- No. Semantic HTML marks what each part of the page is: this is navigation, this is the main article, this is a second-level heading. Structured data, usually JSON-LD, states what the page is about in a schema.org vocabulary. Use both and generate them from the same content so they agree.
- Which semantic HTML elements matter most?
- One main, with header, nav and footer around it; a heading at the start of every section, in order; article for anything self-contained; and real ul, ol, dl and table for lists and data. MDN counts roughly 100 elements, but these few carry most of the meaning.
Stop sending HTMLover Slack.
Create an account in a minute, connect your coding agent, and make your first board.