|
|
HTML <img> tag
Syntax
<img> - </img>
Definition and Usage
The IMG element embeds an image or a video clip in the document.
Required Attributes
| Attribute |
Value |
Description |
| alt |
text |
Defines a short description of the image which is
displayed as alternative text |
| src |
URL |
The URL of the image to display |
Optional Attributes
| Attribute |
Value |
Description |
| align |
top
bottom
middle
left
right |
Specifies how to align the image according to surrounding
text. Deprecated. Use style sheets instead. |
| border |
pixels |
Defines a border around an image. Deprecated.
Use style sheets instead. |
| height |
pixels
% |
Defines the height of an image |
| hspace |
pixels |
Defines white space on the left and right side of the
image. Deprecated. Use style sheets instead. |
| ismap |
URL |
Defines the image as a server-side image map |
| longdesc |
URL |
An URL to a document that contains a long description of
the image |
| usemap |
URL |
Defines the image as a client-side image map. |
| vspace |
pixels |
Defines white space on the top and bottom of the image. Deprecated.
Use style sheets instead. |
| width |
pixels
% |
Sets the width of an image |
Standard Attributes
| id, class, title, style, lang, xml:lang |
For a full description, go to Standard
Attributes.
Event Attributes
| onclick, ondblclick, onmousedown, onmouseup, onmouseover,
onmousemove, onmouseout, onkeypress, onkeydown, onkeyup |
For a full description, go to Event Attributes.
Example
| Source |
Output |
<img border="0" src="../../images/htmllogo.gif" width="120" height="60">
</img>
|
|
|
|