HTML img tag

More Try it Yourself examples below.

The img tag defines an image in an HTML page.

The img tag has two required attributes: srcand alt.

Note:Images are not technically inserted into an HTML page, images are linked to HTML pages. The img tag creates a holding space for the referenced image.

To link an image to another document, simply nest the img tag inside a tags.Try it

Differences Between HTML 4.01 and HTML5

The following attributes: align, border, hspace, and vspace are not supported in HTML5.

In HTML the img tag has no end tag.

In XHTML the img tag must be properly closed.

Specifies the whitespace on left and right side of an image

Specifies an image as a server-side image-map

Specifies a URL to a detailed description of an image

Specifies image sizes for different page layouts

Specifies the URL of the image to use in different situations

Specifies an image as a client-side image-map

The img tag also supports theGlobal Attributes in HTML.

The img tag also supports theEvent Attributes in HTML.

Insert images from different locations

How to insert images from another folder or from another web site.

How to create an image map, with clickable regions. Each region is a hyperlink.

Most browsers will display the img element with the following default values:

HTMLCSSJavaScriptPHPjQueryBootstrapandXML.

Your message has been sent to W3Schools.