Image Tag HTML
The img Tag
The img attribute is used to display images on the webpage. It does not have a closing tag. However, it has an important attribute like src where we can put the image URL.
Syntax:-
Its syntax is:- < img >
Explanation:-
Attribute | Value | Description |
---|---|---|
alt | text | Specifies alternate text for image. |
crossorigin | anonymous use-credentials |
Allow images from third-party sites that allow cross-origin access to be used with canvas. |
height | pixels | Specifies height of an image. |
ismap | ismap | Specifies image as a server-side image map. |
loading | eager lazy |
Specifies whether browser should load an image immediately or to defer loading of images until some conditions are met. |
longdesc | URL | Specifies URL to a detailed description of image. |
referrerpolicy | no-referrer no-referrer-when-downgrade origin origin-when-cross-origin unsafe-url |
Specifies which referrer information to use when fetching an image. |
sizes | sizes | Specifies image sizes for different page layouts. |
src | URL | Specifies path to the image. |
srcset | URL-list | Specifies list of image files to use in different situations. |
usemap | #mapname | Specifies image as a client-side image map. |
width | pixels | Specifies width of an image. |
Code Explanation
All Tutorials related to HTML Basics
Headings
Horizontal Lines
Comments
The p Tag
Line Break
Multiple Line Breaks
Text Format
Elements
Attributes
Multiple Attributes
The img Tag
Ordered List
Unordered List
Tables
Table Properties
The a Tag
Block Elements
Inline Elements
HTML Forms
HTML Colors