If you have already register Login here.
HTML Image
The HTML img tag is used to display an image on the web page. The HTML img tag is an empty tag that contains attributes only, closing tags are not used in the HTML image element.
<h2>HTML Image Example</h2>
<img src="http://www.easytolearning.com/images/logo.png" alt="Easytolearning Logo"/>
Output:
Html Image Example
The src and alt are important attributes of the HTML img tag. All attributes of the HTML image tag are given below.
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 location of the image may be on the same directory or another server.
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. The alt attribute is considered good for the SEO perspective.
It is an optional attribute that is used to specify the width to display the image. It is not recommended now. You should apply CSS in place of width attribute.
It specifies the height of the image. The HTML height attribute also supports iframe, image and object elements. It is not recommended now. You should apply CSS in place of height attribute.
Element | Chrome | IE | Firefox | Opera | Safari |
<h1> to <h6> | Yes | Yes | Yes | Yes | Yes |
Tag | Description |
---|---|
<img> | Defines an image |
<map> | Defines an image-map |
<area> | Defines a clickable area inside an image-map |
<picture> | Defines a container for multiple image resources |
© 2023 Easy To Learning. All Rights Reserved | Design by Easy To Learning