Importance Of Height and Width Tags

Importance Of Height and Width Tags

This is a very important factor that many people (including myself until some time ago) tend to overlook. When you use images or tables on your pages you should always include the height and width tags. If the browser does not see those tags it will need to figure the size of the image, then load the image and then load the rest of the page. Here is an example of code containing those tags:

<img id=”moon” height=”200″ width=”450″ src=”http://www.domain.com/moon.png” alt=”moon image” />

When the height and width tags are included the browser will automatically know the size of the image. As a consequence it will be able to hold a place for the image and load the rest of the page contemporaneously. Apart from the improvement on the load time of the page this method is also more user friendly since the visitor can start reading the text or other information while the image is being downloaded.

The following two tabs change content below.

Hamza Basharat

Hi. I'm Hamza Basharat, I love to find solutions and help people. I'm a senior writer at TheHelptimes and AboutEngg, and currently studying computer engineering.