Skip to main content

<img>


  • Date:
    17/08/2022
  • Modified:
    04/03/2025
  • Category:
    Elements

The <img> element embeds an image into a page. The element contains a reference to an image file.

See figure and figureGroup for examples. See Images for information about the image file.

Notes

Use <figure> as a container for an image if there is information present that is linked to the image (like caption, title, description). If the image needs to span the entire width of it’s parent container, use <figure> as well.

Attributes

NameExplanationRequired
alt

The alt attribute contains an alternative text for the image. Leave content empty.

Yes
role

Defines the purpose of the image. Use value informative unless otherwise stated on the method-specific page.

Yes
src

Refers to the location of the image file. For example: src="/img/320066_p009-1.jpg". For naming image files, see Image format.

Yes
type

Use value cover for cover image. Otherwise leave empty.

No

  • Date:
    17/08/2022
  • Modified:
    04/03/2025
  • Category: