Image width and height attribute

By default the image is displayed with the original size on the browser. To scale an image to a different width and height, the width and height attribute of the <img> element is used.

* Positive integers (in pixels)
* Percentages (percentage of the parent block)

No Border
<img src="logo.jpg" width="200">
Image with border
<img src="logo.jpg" width="300" height="200">

No BorderImage with border

If the width and height is changed from the original proportions, the image will be rendered disproportionately an will be distorted.
Related Tutorial
Follow Us #