Start an interface with the content and its structure, not the layout you want on screen. Semantic markup uses HTML elements to express what content means and how its parts relate. CSS can then control appearance, while JavaScript adds behavior. section 3.4 section 2.1.5
Choose elements by purpose:
- Use <header>, <main>, <nav>, and <footer> for applicable page regions; use <section> and <article> to group content where they fit. section 3.4.2
- Use headings, paragraphs, and lists for the content they describe, rather than anonymous containers with classes that merely suggest meaning. section 3.4.2
- Prefer native controls such as <button> for interaction. They provide semantics, keyboard interaction, and focus behavior without recreating those features. section 3.5.7
Replace anonymous containers
Instead of <div id="header"><div class="title">Coffee Roasters</div></div>, use <header><h1>Coffee Roasters</h1></header>. Put navigation links in <nav> and, when they form a list, mark them up with <ul> and <li>. The elements communicate their roles without relying on class names to explain the document. section 3.4.2
Listing 3.3 A simple markup following semantic HTML best practices
<header>
<h1>Coffee Roasters</h1>
</header>
<main>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/products">Products</a></li>
</ul>
</nav>
</main>
A short page fragment shows a heading, main region, and list of navigation links expressed with native elements. section 3.4.2
A <div> remains useful when no semantic container fits; the problem is making it the default for everything. Meaningful elements make the document easier to navigate and maintain and give assistive technology and crawlers more context. Use ARIA to fill gaps, not to replace an element that already expresses the intended role. Begin with useful HTML that renders before JavaScript, then enhance it. section 3.4.2 section 3.5 section 14.7.2






