HTML Links


Go to main Page

Images in HTML

  1. To insert image in a HTML document we we use <img> tag.
  2. <img> tag is an empty tag because it has no closing tag.
  3. In the tag we use the src attribute to specify the source of the image.
  4. We also used the alt attribute to specify some text if the image does not found.
Adding Image in webpage Basic Syntax


<img src="demo.png" alt="Pic not Found">

 

Explaination

src- is used to specify the source of the image.

alt- is used to show text if an image is not found.

Adding Online image in HTML

we can add an online image without downloading it by using the following code.


<img src="https://cdn.pixabay.com/photo/2019/04/24/14/48/hanover-4152279__340.jpg" alt="Online image not Found">

 


Image from a Folder in HTML

we can get image from another folder by giving its complete address.


<img src="foldername/image.jpg" width="200px" height="200px" alt="Folder image not Found">

 


Width and Height of image in HTML

we can specify width and height by using width and height attributes .


<img src="https://cdn.pixabay.com/photo/2019/04/24/14/48/hanover-4152279__340.jpg" width="200px" height="200px" alt="Online image not Found">

 


You will learn more about images in CSS.