Back to HTML

Common Semantic Markup Mistakes

Coding Tutorials Team 14 June 2026

The same handful of mistakes appear across almost every codebase. None are obscure, and each has a straightforward correction that costs less than the workaround it replaces.

The clickable div

The most consequential mistake. An element with a click handler that is not a button or a link is not focusable, is not announced as interactive, and does not respond to the keyboard.

The workaround piles up: a role, a tabindex, a keydown handler for enter and space, and a set of state attributes to maintain. All of that reproduces, imperfectly, what a button element does for nothing.

Use a button for actions and a link for navigation. If the appearance is the objection, style the button. Removing the default appearance is a handful of CSS declarations.

Headings chosen for size

Picking a heading level because it looks right rather than because it fits the structure. This inserts phantom sections into the outline and, in the reverse case, produces text styled as a heading that is not one and therefore cannot be navigated to.

Choose the level by position in the document and set the size in CSS. The two decisions are independent and treating them as one causes both problems at once.

Lists that are not lists

A series of divs where a list belongs. The cost is that a screen reader announces a list and its item count, letting the user skip or explore, and none of that happens for a set of divs.

Navigation menus, card grids, tag collections and step sequences are all lists. Bullets can be removed in one line, so their absence is never a reason to avoid the element.

Tables used for layout

Still present in older code and in anything generated by certain tools. A layout table announces itself as a table with dimensions, invites navigation as data, and forces reading order to follow the grid.

The exception remains HTML email, where support for modern layout is genuinely poor. On the web, Flexbox and Grid do the job better and with less markup.

Placeholder instead of label

Covered at length elsewhere and worth listing here because it is so widespread. The hint disappears when the field is filled, the contrast is usually inadequate, and support in assistive technology is inconsistent.

Every input needs a label. Hide it visually if the design demands, using a technique that keeps it in the accessibility tree.

Section used as a generic wrapper

Replacing every div with a section in the belief that it is more semantic. A section is a thematic group with a heading, and one without a heading is almost always a div wearing a costume.

The specification is explicit that a div is the right element when nothing else fits. Using one is not a failure.

Aria-hidden on focusable content

Hiding something from assistive technology while leaving it in the tab order. The result is that a keyboard user can focus an element their screen reader insists does not exist, which is thoroughly disorienting.

Where content should be unavailable, hide it properly with display none or the inert attribute so it leaves both the tree and the tab order.

Removing focus outlines

Suppressing the outline because it looks untidy, without a replacement. This makes a site unusable without a mouse.

The focus-visible pseudo-class shows an indicator to keyboard users and not to mouse users, which addresses the original complaint without the cost.

Multiple main elements or none

Either breaks the most useful landmark on the page. There should be exactly one, containing the content unique to that page, and it is the natural target for a skip link.

Icon buttons with no name

A button containing only an icon has no text content and therefore no accessible name. Close controls, menu toggles and search buttons are the usual offenders.

Add visually hidden text or an aria-label, and hide the icon itself from assistive technology so it is not announced alongside.

The pattern behind all of them

Almost every item here comes from choosing an element for how it looks and then patching the meaning back on. Choosing for meaning and styling afterwards produces less code, fewer defects and markup that still makes sense to whoever reads it next.