
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML - <img> Tag
Description
The HTML <img> tag is used to put an image in an HTML document.
Example
<!DOCTYPE html> <html> <head> <title>HTML Tag</title> </head> <body> <img src = "https://www.tutorialspoint.com/images/html.gif" alt = "HTML Tutorial" height = "150" width = "140" /> </body> </html>
This will produce the following result −
Global Attributes
This tag supports all the global attributes described in − HTML Attribute Reference
Specific Attributes
The HTML <img> tag also supports the following additional attributes −
Attribute | Value | Description |
---|---|---|
align | top bottom middle left right |
Deprecated− Specifies the alignment for the image. |
alt | text | Specifies alternate text |
border | pixels | Deprecated − Specifies the width of the image border. |
crossorigin![]() |
anonymous use-credentials | It allows images from third-party sites that allow cross-origin access to be reused with canvas. |
height | pixels or % | Specifies the height of the image. |
hspace | pixels | Deprecated − Amount of white space to be inserted to the left and right of the object. |
ismap | URL | Defines the image as a server-side image map. |
longdesc | text | Deprecated − Specifies a URI/URL of a long description - this can elaborate on a shorter description specified with the alt attribute. |
src | URL | the url of an image |
usemap | #mapname | Defines the image as a client-side image map and used alongwith <map> and <area> tags. |
vspace | pixels | Deprecated − Amount of white space to be inserted to the top and bottom of the object. |
width | pixels or % | Sets the width of an image in pixels or in %. |
Event Attributes
This tag supports all the event attributes described in − HTML Events Reference
Browser Support
Chrome | Firefox | IE | Opera | Safari | Android |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |
html_tags_reference.htm
Advertisements