Images in HTML:

Web site will look very simple and bored without image. So an image is a very important part of any web site. By adding images to web site user will get attracted to that web site.
In HTML <img/> tag is used to insert images to your html web page. This tag is also don’t have ending tag. To place an image on your HTML page locate the image file in a file tree. So it will easy to call an image.


The “src” Attribute:

The “src” means source value is a path of the image. It can be either global or local. In above example we used global url and in local you have to use any image which is on your PC.

The “alt” Attribute:

The “alt” attribute is used to give an alternative name for that image. It is very useful because some time by any reason image will not get opened or if there are many images in one web page so it will load the image at that time the alternative text will display at the place of image. So always use “alt” attribute.



If you are not providing alternative text and the image is not viewed at this time in your web page a broken icon will be displayed.

Size of an Image:

It is necessary to specify the size of an image otherwise the page will flicker when the image loads.

You have to use style attribute to assign width and height to an image.



One response to “Images in HTML”

  1. Joy Tee says:

    Heya i am for the first time here. I found this board and I to
    find It really useful & it helped me out a lot.

Leave a Reply

Your email address will not be published. Required fields are marked *