HTML Image Tag

HTML image tag is used to define images in HTML document.

image tag doesn't have a closing tag. It uses the attributes value to manipulate images.


SRC Attribute

The 'SRC' Attribute of the <img> tag defines the source of the image. The path of the image is provided in the src attribute like shown below.

<img src="img/final.jpg">

Alt Attribute

In case if the image cannot be displayed, alternate text will be displayed. Whatever is provided in the alt attribute will be displayed as alternate text.

<img src="" alt="Web Design Ebook">

Height & Width Attributes

The height and width of an image can be specified using height and width attribute, if these attributes are not specified the image will be displayed in its original size.

<img src="img/final.jpg" alt="Web Design Ebook" height="100px" width="100px">

Image Links

Images can be used as clickable links by nesting them inside the anchor tag <a>

<a href="www.ieatcss.com"><img src="img/final.jpg"></a>

Example


<img src="img/final.jpg">
<img src="" alt="Web Design Ebook">
<img src="img/final.jpg" alt="Web Design Ebook" height="100px" width="100px">
<a href="#"><img src="img/final.jpg" height="100px" width="100px"></a>
		

Preview

Next Lesson > HTML Table Tags