Images

The <img> tag is one of the more complex tags, since it needs to be given several values to work.

<img src="photo1.jpg" width="300" height="400" alt="photograph of school">
  • src
    the source (filename) of the image
  • width
    the width of image
  • height
    the height of the image
  • alt
    text to  display while the image is loading, or if the image cannot be found. It is also used for screen readers.

Notes:

  • Specifying the width and height of the images allows the web browser to set aside the correct area of the page before the images are actually downloaded. Otherwise the text may be placed on the page, and then move when the images are downloaded.
  • Do not use the width and/or height images to resize images. The original, full-size image would still be downloaded – wasting time and data.