HTML <img> Tag


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">
Sunset Image
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