Skip to content
Tutorials Center
My learning

Topics

Lesson 116 of 122 Β· Projects

Project: Blog Article

Mark up a complete blog post with semantic HTML. Use article, header, time, a table of contents, figure, blockquote, aside and footer, then lay it out with CSS.

Blog posts, news stories, recipes and documentation pages all share the same shape: a title, an author and date, a block of text broken into sections, some pictures with captions, perhaps a quote, a box of related links and a footer. In this project you will build that shape from scratch with semantic HTML, the elements that describe what each part of the page is.

Good semantics pay off three times. Screen-reader users can jump between landmarks and headings. Search engines and reading modes understand which part is the article and when it was published. And your CSS gets simpler, because the structure is already there.

The article you will build is a short gardening post, "Growing Tomatoes on a Small Balcony". As in the previous project, each step has its own editor and the final step combines everything into one complete page.

Step 1: The page frame

An article never stands alone. It lives inside a page that also has a site header, navigation and a footer. Start with those landmarks, all covered in Semantic Elements:

Step 1: page frame

Notice that the site name is a plain paragraph with a link, not a heading. On an article page, the single <h1> belongs to the article's own title, which is what the page is about.

Step 2: The article header

The top of the article gets its own <header>. Inside it go the title, the byline and the dates. Two elements do the heavy lifting:

  • <time> with a datetime attribute gives each date a machine-readable form, while the visible text stays friendly.
  • <address> marks up contact information for the author of the article. That is its only correct use; it is not for postal addresses in general (see Quotations, Citations and Abbreviations).
Step 2: article header

rel="author" tells software that the link leads to information about the author. The "updated" date matters: readers want to know how fresh advice is, and search engines show dates in results.

Step 3: Table of contents and sections

Long articles benefit from a small table of contents that jumps to each part. It is navigation, so wrap it in <nav> with a label that tells it apart from the main menu. Each part of the article is a <section> with an <h2> and an id for the links to target, as you learned in Link Targets and Page Jumps.

The instructions for planting are a sequence, so they belong in an ordered list.

Step 3: contents and sections

<dfn> marks the place where a term is defined. Readers see it in italics; software can use it to build a glossary.

Step 4: A figure and a quotation

Now add media. The harvest chart is an image that is referred to from the text but could move elsewhere without breaking the flow, which is the definition of a <figure>. Its <figcaption> explains it to everyone; its alt text describes the image for people who can't see it. The Figures and Captions lesson explains how the two work together.

A quotation from another gardener goes in a <blockquote>, with the source in a <figcaption> so the attribution stays outside the quoted words.

Step 4: figure and quote

Alt text versus caption. The caption ("Weekly harvest from three plants") is read by everyone. The alt text stands in for the picture itself, so for a chart it should give the key numbers a sighted reader would take away.

Step 5: An aside and the article footer

Content that is related but not part of the main text goes in an <aside>: a tip box, related posts or a short author bio. Inside an article, an aside relates to that article; outside it, it relates to the whole page.

The article ends with its own <footer>, which holds information about the article: tags, the author's bio and a link back to the contents.

Step 5: aside and footer

rel="tag" says the link leads to a page listing posts with that tag.

Step 6: The complete article

Here is the finished page. The CSS adds:

  • A comfortable reading measure: about 65 characters per line using max-width: 65ch.
  • A two-column grid on wide screens, with the table of contents and related posts in a sidebar. On narrow screens everything stacks in one column, thanks to a media query (see Responsive Web Design).
  • A sticky sidebar that stays in view as you scroll.
  • Breadcrumb navigation with aria-current="page", as described in Building Navigation Menus.

Make the preview wider and narrower to see the layout change.

Step 6: complete article page

The table of contents and related posts now live in a plain <div class="sidebar">. That <div> is only a styling hook (see Div and Span); the meaning comes from the <nav> and <aside> inside it.

Going further

  • Structured data. Add a JSON-LD block of type BlogPosting with the headline, author and dates so search engines can show rich results. Structured Data shows how.
  • Social previews. Open Graph tags decide the title and image shown when someone shares the link; see Social Sharing Previews.
  • Responsive images. If you use photos instead of an SVG chart, serve several sizes with srcset (Responsive Images).
  • Check the outline. Open DevTools' accessibility panel or a headings bookmarklet and confirm the order: one <h1>, then <h2> for every section.

Check your understanding

Quick check Β· 5 questions

of 5 answered You scored / 5 Β· perfect!

  1. 1. Which element should wrap the blog post itself?

    An <article> is a self-contained piece that would make sense on its own, such as a blog post, news story or comment.
  2. 2. What is the correct use of <address> in this project?

    <address> is only for contact details of the person or organization responsible for the nearest article or the page.
  3. 3. Why does each date use <time datetime="2026-09-14">?

    The datetime attribute holds an unambiguous ISO-style value; the visible text can be written any way readers like.
  4. 4. The chart has a caption. Does it still need alt text?

    The caption is read by everyone and describes the figure; alt replaces the picture for people who can't see it.
  5. 5. Where does a "Related posts" box belong?

    Related but separate content is exactly what aside is for.

Summary

  • Frame the page with a site <header>, <nav>, <main> and <footer>; give the article the page's only <h1>.
  • An <article> gets its own <header> (title, byline in <address>, dates in <time>) and <footer> (tags, bio).
  • A labeled <nav> holds the table of contents; <section>s with ids are its targets.
  • Use <figure> and <figcaption> for charts and quotations, with accurate alt text for images.
  • <aside> holds related content; a <div> is only a styling hook.
  • CSS Grid and one media query turn the same HTML into a sidebar layout on wide screens.

Next lesson: Project: Accessible Contact Form, where you build a form that works for everyone and shows what it would send.