Skip to content
BENIBIX Learn

Semantic HTML

Development🌐 Web DevelopmentBrowser Code

Also known as Semantic Markup, Semantic Elements, HTML5 Semantic Elements

Pick the HTML tag that says what each part is, like nav, main or button.

Think of it like

Think of it like naming the rooms on a house plan. Kitchen and bedroom say more than room one and room two.

Example

Emma swaps her plain div boxes for header, nav, main and footer. A screen reader can now jump straight to her menu.

Why it matters

It makes a site usable with a screen reader and a keyboard. It also helps search engines read the page.

Definition

Semantic HTML means picking the element that says what a part is. Use nav for the menu, main for the main content and footer for the bottom. Use button for a button, not a box made to look like one. The page can look the same either way. But screen readers, search engines and other developers can now tell the parts apart.

Example code

html
<nav>
  <a href="/">Home</a>
  <a href="/menu">Menu</a>
</nav>
The nav tag tells people and machines that these links are the menu.
Both pages look alike. Only the one on the right says what each part is.

Common mistake

Building every part from div boxes. The page looks right, but its meaning is lost.

Key takeaways

  1. 1
    Say what it is. Pick the element that names the part.
  2. 2
    Free help. Real buttons work with keys by default.
  3. 3
    Same look. Meaning changes, the design does not.

Compare

Learn it properly