Skip to main content
Albero Academy

Images & Semantic HTML

Add images and media the accessible way, then structure a page with real semantic landmarks instead of a wall of divs.

Chapter 3HTML14 min readBeginner friendly
  • #HTML
  • #Images
  • #Semantics

A page of only text is rare. This chapter covers embedding images and media accessibly, then the semantic elements that give a page a real skeleton — the difference between a professional, accessible site and a soup of nameless <div>s.

Images & alt text

The image element is empty (no closing tag). It needs two attributes: src (where the file is) and alt (a text description):

an image
<img src="/images/classroom.jpg"
alt="Students pair-programming during a live Albero session"
width="800" height="500">

The alt text is read aloud to blind users, shown if the image fails to load, and indexed by search engines. Describe what the image communicates. For purely decorative images, use an empty alt="" so screen readers skip them.

To serve the right size to each device, use <picture> with several sources, or the srcset attribute. The browser picks the best fit and skips the rest.

Audio & video

Native audio and video need no plugins — just a controls attribute for the play/pause UI:

video & audio
<video controls width="640" poster="thumb.jpg">
<source src="lesson.mp4" type="video/mp4">
<source src="lesson.webm" type="video/webm">
Your browser doesn't support video.
</video>
<audio controls>
<source src="podcast.mp3" type="audio/mpeg">
</audio>

Multiple <source> tags let the browser fall back to a format it supports. The text after the sources shows only when nothing works.

Semantic structure

Semantic elements name the region of the page. They read identically to a plain <div> visually, but assistive tech and search engines rely on them to navigate:

ElementRegion
<header>Top of the page or a section — logo, nav, title.
<nav>A block of navigation links.
<main>The one main content area (exactly one per page).
<section>A thematic grouping, usually with its own heading.
<article>A self-contained item — a blog post, a card.
<aside>Side content — related links, a callout.
<footer>Bottom of the page or section — copyright, links.
a semantic page
<body>
<header>
<nav><a href="/">Home</a> <a href="/programs">Programs</a></nav>
</header>
<main>
<article>
<h1>Become a job-ready data analyst</h1>
<p>A 6-month, mentor-led programme…</p>
</article>
<aside>
<h2>Next batch</h2>
<p>Starts 12 January.</p>
</aside>
</main>
<footer>
<p>© 2026 Albero Academy</p>
</footer>
</body>

When to use div and span

<div> (block) and <span> (inline) carry no meaning — they're generic boxes for grouping and styling. Use them only when no semantic element fits. If a block is really a navigation menu, use <nav>, not a <div class="nav">.

Practice

Rebuild the "About me" page from Chapter 1 using semantic landmarks: a <header> with your name, a <main> with two <section>s, an image with proper alt text, and a <footer>.

Key takeaways

  1. 01Every <img> needs alt text that describes what the image communicates; decorative images use alt="".
  2. 02Set width/height on images to prevent layout shift as they load.
  3. 03<video>/<audio> with multiple <source> tags need no plugins.
  4. 04Semantic landmarks (header, nav, main, section, article, aside, footer) give the page a real, navigable structure.
  5. 05Use div/span only when no semantic element fits.