The <img> element

Short for ‘Image’. Inserts an image into the content, using information from a bitmap or vector graphics file from a URI.

This is an empty element, so it shouldn't have a closing tag.

Full list of attributes

All the usual HTML global attributes are available

alt
Textual alternative to image, for people who can't see the image as intended.
crossorigin
A CORS settings attribute for images from third party sites that are to be used with a <canvas>.
height
Height to display image, in CSS pixels or as percentage of natural height.
ismap
Indicates that the image is a server-side image map. Must be inside an <a> element.
src
URI of the picture file.
srcset
Alternative URIs and specifications that allow the browser to select an appropriately sized image for the viewport (for example, a lower resolution image for devices with small screens).
usemap
Indicates that the image is a client-side image map, and gives the name of the <map> element to use.
width
Width to display image, in CSS pixels or as percentage of natural width.

Further information

The Web Design Academy Contact us

By form

By Phone

+44 (0)113 234 4611

By email

enquiries@thewebdesign.academy

By snail mail

Suite 3 15 South Parade Leeds LS1 5PQ United Kingdom