• in
InterCourses
CoursesBlogs
0
← Introduction to HTML
○What Is HTML? See Tags in Action○Exercise: Build the Meridian Signal○Complete HTML5 Page Structure: See It in Action○Exercise: Build a Complete HTML5 Page✦Module Quiz
○Heading Hierarchy Demo: H1 and H2○Exercise: Extend the Signal Brief○Paragraphs and Inline Tags Demo○Exercise: Write Meridian's Survey Notes○List Types Demo: Steps, Items, and Terms○Exercise: Build a Crew member Loadout○Challenge: Transmit a Rescue Signal✦Module Quiz
○Hyperlinks●Images○Applying Styles to HTML✦Module Quiz
○Div and Span○HTML Tables○Classes and IDs○Review: Structured Profile✦Module Quiz
○Project 1 - Visiting Card Structure○Project 1 - Visiting Card Actions✦Module Quiz
○The Head Element and Page Title○Meta Tags○HTML Entities✦Module Quiz
○Form Basics Demo: Join the Meridian Relay○Exercise: Build a Night-Shift Check-In○Input Types Demo: Build a Mission Profile○Exercise: Record Beacon Maintenance○Choice Controls Demo: Select Training Modes○Exercise: Plan a Supply Pickup○Response Controls Demo: Send a Mission Reply○Exercise: Build a Rescue Dispatch Report○Challenge: Send an Emergency Beacon✦Module Quiz
○Project 2 - Contact Us Form Structure○Project 2 - Contact Us Form Actions✦Module Quiz
○Embedding Video○Embedding Audio○Iframes✦Module Quiz
○Semantic HTML Tags○Details, Figure, and Figcaption✦Module Quiz
○Project 3 - Resume Semantic Structure○Project 3 - Resume Links and Actions✦Module Quiz

Images

Mission

Add a small photo strip to a local walking-club page. Each image should still make sense to a visitor who cannot see it, and one should lead somewhere useful when clicked.

What you'll build

A walking-club photo strip with descriptive alt text, one image reserving space with dimensions, and one clickable image link.

The <img> tag puts an image on a page. It is a void element with no content or closing tag; a trailing / is optional.

Basic syntax

html
<img src="cat.jpg" alt="A tabby cat sitting on a windowsill" />
AttributeRequiredDescription
srcYesPath or URL to the image file
altYesAlternative text description
widthNoWidth in pixels
heightNoHeight in pixels

The src attribute

src can be a relative path to an image in the same project or an absolute URL:

html
<!-- Relative path -->
<img src="images/logo.png" alt="Company logo" />

<!-- Absolute URL -->
<img src="https://commons.wikimedia.org/wiki/Special:FilePath/Fronalpstock_big.jpg?width=320" alt="Mountain landscape" />

Why alt text matters

  • Accessibility: Screen readers read alt text aloud for people who cannot see the image.
  • Fallback: If the image fails to load, the browser displays the alt text.
  • SEO: Search engines use alt text to understand image content.
html
<!-- Good: descriptive alt text -->
<img src="sunset.jpg" alt="Orange and pink sunset over the Pacific Ocean" />

<!-- Bad: missing alt text -->
<img src="sunset.jpg" />

<!-- Correct for purely decorative images -->
<img src="divider.png" alt="" />

Controlling size

html
<img src="photo.jpg" alt="Profile photo" width="200" height="200" />

Setting width and height lets the browser reserve space before the image loads. That prevents distracting layout jumps.

Tip

For responsive images, omit the pixel attributes and use CSS width: 100%; height: auto; instead.

Linking an image

Wrap an <img> in an <a> tag to make it a clickable link:

html
<a href="https://www.example.com">
    <img src="banner.jpg" alt="Visit Example.com" />
</a>

Checkpoint

Preview the page. If remote images cannot load in the embedded preview, read their descriptive alt text and check your markup; the tests do not require a network connection. Every meaningful image should have a useful alt description; at least one should reserve visible space with width and height, and clicking one should follow its link.

Your Task

  1. Add at least two <img> elements using public image URLs.
  2. Give both images non-empty, descriptive alt text.
  3. Add width and height attributes to at least one <img>.
  4. Wrap one image in an <a href="https://..."> so it links to a useful page.

Payoff

Your walking-club page can now communicate with images without leaving visitors who use assistive technology behind.

Hint 1
1 / 4
HINT 1

The <img> tag is self-closing: <img src="path/to/image.jpg" alt="description" />

HINT 2

alt text is not optional — it's read aloud by screen readers and shown when the image fails to load.

HINT 3

Use width and height attributes to reserve space and prevent layout shifts.

HINT 4

For decorative images that add no meaning, use alt="" (empty string) so screen readers skip them.

Loading editor…
READY
intercourses
html