HTML IMAGES


Images are used to make web pages beautiful and more descriptive. More information can be presented through images and in a much easier way.

HTML displays images using <img> tag.

<img> tag is an empty tag. It does not have a closing tag.It has attributes only.

Syntax of <img> tag

<img src="image_url" alt="about image">

Syntax explanation:

<img src="flowers.jpg" alt="Beautiful flowers">
Try It

Output:

Beautiful flower

HTML img tag Attribute

<img> tag has other attributes too like width, height and border.These attributes let the user to define height,width and border of image.

A working example:

<img src="cat.jpg" width="250px" height="250px" border="2">
        
Try It

Output:

cat