<img>
tag is used to display image on the web page. It is an empty tag that contains attributes only, closing tags are not used in HTML image element.
<img src="url" alt="some_text" height="px" width="px">
Example :<img src="url" alt="some_text" height="px" width="px">
It is a necessary attribute that describes the source
or path of the image.
It instructs the browser where to look for the image on the server. The "src"
attribute specifies the URL (web address) of the image. The location of image may be on the same directory or another server.
If a browser cannot find an image, it will display the value of the alt attribute:
The "alt"
attribute defines an alternate text for the image, if it can't be displayed.
The value of the alt
attribute describes the image in words. It is considered good for SEO prospective.
The "alt"
attribute provides an alternate text for an image, if the user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).
If a browser cannot find an image, it will display the value of the alt attribute:
With the help of this attribute we can customize the size of the Image
To change the size of HTML Image we can use "height"
and "width"
attributes.
We can also use Style
to change the size of HTML Image. We will discuss style
later.
![]() |
![]() |
![]() |
![]() |
![]() |
|
---|---|---|---|---|---|
<img> |
List of color names supported by all browser »
List of character codes to display special character »
List of all language supported by all browser »
List of Country code supported by all browser »