i

Learn HTML and CSS in 10 Days

Sizing Images

It is very important to get to know the size of an image such that you can notify the browser of the length of the image when the web page loads itself. The browser will store some space for the image and will process the page faster. There are several ways to provide a size to the image such that they work properly. One way is to use the height and width attributes inside the tag.

In addition to that, one can also provide the desired size of the height and width in CSS.

When both the CSS as well as the HTML attribute are utilized, the attributes in the CSS file will take precedence over the HTML attribute.

img {

  height: 200px;

  width: 200px;

}