References

Collection of references for web development.

HTML img tag

Description

The HTML <img> element is used for embedding images in a HTML document.

Attributes

Attribute Value Description
alt string Alternative text string to display on browsers that do not display images. The alt is required if the href attribute is used.
crossorigin anonymous
use-credentials
Allow data from third-party websites that allow cross-origin access so you can reuse it.
decoding sync
async
auto
Specifies the decoding hint that is sent to the browser.
height number Specifies the height of the element, default is measured in pixels.
ismap boolean Specifies whether the image is part of a map or not.
longdesc URL Specifies the URL to a detailed description of the image.
sizes list Specifies image sizes for different document sizes.
src URL The URL of the file to embed in the document.
srcset list Specifies a list of resources to be used for different conditions.
usemap #imagemapname Specifies the image map associated with the element.
width number Specifies the width of the element, default is measured in pixels.

Example

<img src="https://via.placeholder.com/350x150" width="350" height="150" alt="Example Image 350x150">

More Examples