Book 3 — HTML, CSS Basics

Python for All

Chapter Four — Semantic Structure

Thanasis Troboukis  ·  All Books

Book Three · Chapter Four

Semantic Structure

HTML5 gave us tags that describe what content means, not just how it looks. These tags are the backbone of every well-built article page.

Why Semantics Matter

Until this chapter, we have used generic containers. You could wrap everything in <div> tags and the page would look identical. But a browser — and a search engine, and a screen reader — cannot tell a headline from a byline from a footer if they are all just <div> elements.

HTML5 introduced semantic elements: tags whose names describe the role of the content they contain. When Google sees an <article> tag, it knows that content is a self-contained piece of journalism. When a screen reader encounters a <nav>, it offers to skip directly to navigation. These tags cost nothing to write, and they make your pages more discoverable, more accessible, and more professional.

The rule: Use the tag that best describes what the content is, not what you want it to look like. Appearance is controlled by CSS — that comes later.

article, header, and footer

The three most important structural tags for a news article are:

HTML · Try it

HTML

CSS

Live Preview

section and aside

<section> groups related content within an article. Each section typically has a heading. If you find yourself writing a long article with named parts — "Background", "Reactions", "What happens next" — each of those is a <section>.

<aside> holds content that is tangentially related to the main text: a sidebar fact box, a glossary of terms, a related-articles list. On screen, it is often displayed next to the main content.

HTML · Try it

HTML

CSS

Live Preview

Lists — Ordered and Unordered

Lists are among the most useful structures in journalism: bullet-point summaries, numbered timelines, key facts boxes. HTML provides two types:

Both contain <li> (list item) elements.

HTML · Try it

HTML

CSS

Live Preview

Your Turn — A Structured Article

Build a properly structured article using the semantic tags you have learned. Your article should include:

HTML · Your turn

HTML

CSS

Live Preview

What you have learned in this chapter: <article>, <header>, <footer>, <section>, <aside>, and <ul>/<ol>/<li>. Your HTML is now semantically meaningful. Next: making it look great with CSS.

Chapter Navigation

Move between chapters.