Description:

The <img> element embeds an image in the current document at the location of the element's definition. The <img> element has no content; it is usually replaced inline by the image designated by the src attribute, the exception being for left or right-aligned images that are "floated" out of line.

Example Code:
<img alt="Sunset Image" src="image/sunset.jpg" width="300" height="226">
Result:
Sunset Image
Attributes:
Attribute Definition
name Assigns a name to an image. This is used when referencing the image with stylesheets or scripts. However, you should use the id attribute instead.
longdesc Specifies a URI/URL of a long description - this can elaborate on a shorter description specified with the alt attribute.
src Location of the image.
alt Alternate text. This specifies text to be used in case the browser/user agent can't render the image.
Global Attributes:

The <img> tag also supports the Global Attributes in HTML5

Event Attributes:

The <img> tag also supports the Event Attributes in HTML5



Last updated on 2 August 2018 By Rene Spronk

View All HTML Tags

Errors? Please help to keep this list up to date, If you find any errors, please contact us, so that we can get them fixed.