HTML <img> Tag
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.
Specific 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. |
Other Attributes:
| Attribute | Definition |
| dir |
Specifies the text direction for the content in
an element.
|
| class | Specifies a classname for an element. |
| id | Specifies a unique id for an element. |
| lang | Specifies a language code for the content in an element. |
| title | Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip"). |
| style | Specifies an inline style for an element. |
| alt | Alternate text. This specifies text to be used in case the browser/user agent can't render the image. |
Example Code:
<img alt="Sunset Image" src="image/sunset.jpg" width="300" height="226" />
Result
