20 min read
Semantic Page Layout
header, nav, main, section, article, aside and footer — elements that describe the regions from your wireframe — plus div and span.
What Does Semantic Mean?
Remember the regions in your wireframe: header, navigation, main content, sidebar and footer. HTML has an element for each one.
| Semantic layout elements | |
|---|---|
How the tea room home page is structured
The Home Page Structure
index.html (body only)HTML
<body> <header> <a href="index.html"><img src="images/logo.svg" alt="Ceylon Leaf Tea Room home" width="200"></a> <nav> <ul> <li><a href="index.html">Home</a></li> <li><a href="menu.html">Menu</a></li> <li><a href="gallery.html">Gallery</a></li> <li><a href="order.html">Order</a></li> <li><a href="about.html">About</a></li> </ul> </nav> </header> <main> <section> <h1>Welcome to the Ceylon Leaf Tea Room</h1> <p>Fresh Ceylon tea and homemade cakes in the heart of Galle Fort.</p> </section> <section> <h2>Why visit us?</h2> <article> <h3>Fine Ceylon teas</h3> <p>Twelve teas from the hill country.</p> </article> <article> <h3>Homemade sweets</h3> <p>Love cake, Swiss roll and kokis, baked every morning.</p> </article> </section> </main> <footer> <p>12 Church Street, Galle Fort · Open daily 9 am – 7 pm</p> </footer></body>What the browser shows
Without CSS the page looks plain — that is expected. The structure is now clear to browsers, screen readers and search engines, and it is ready to be styled.
div and span
Generic containers
| <div> | <span> |
|---|---|
| A block container — starts on a new line and takes the full width | An inline container — sits inside a line of text |
| Groups larger chunks for layout, e.g. a row of cards | Wraps a few words, e.g. to colour a price |
<div class="cards">…</div> | <p>Only <span class="price">LKR 650</span></p> |
div and span have no meaning of their own. Use a semantic element when one fits; use div/span only for styling hooks.
Practice
Choose all that apply.
More lessons in HTML · Next: HTML Tables · Previous: Links Between Pages
