Images

Tags
Summary

Use the img tag to add an image to a page.

Situation

You want to put an image on a page.

Action

Suppose you want this:

Goal

Here's the code:

  • <h1>Happiness</h1>
  • <p>What makes people happy?</p>
  • <p> <img src="rosie1.jpg" alt="A doggo"> </p>

img shows the image. src gives the URL of the image file. alt gives a text alternative when the image can't be seen. It also influences the page's search ranking.