Home  »  HTML   »   img

An img tag represents an image. We can display any supported image type using img tag.

src

represents URL of the image file.

  • URL
alt

defines alternate text for the image, if the image for some reason cannot be displayed

  • Text
sizes

defines different sizes of the image.

  • Text defining viewport widths separated by commas. These widths will load relevant image source defined in scrset attribute.
srcset

defines multiple image sources.

  • Text with two parameters. A URL followed by either width or pixel density

HTML img Example:

Edit Example