HTML img width Attribute
Definition and Usage
The width attribute specifies the width of the image.The height, and width attributes are set to let the browser know how big the image is, so it can reserve space for the image in the page layout. If these attributes are not set, the site layout will change during loading (while waiting for images to load).
Note: Rescaling images is not good coding practice. Downsizing a large image to fit your site will use more bandwidth than necessary. It is better to manually rescale the image before using it in your website.
Syntax
<img width="length" /> |
Syntax Example
<a type="text/html"> |
Attribute Values
Value | Description |
---|---|
pixels | Specify image width in pixels (like "100px", or just "100") |
percent | Specify image width in percent of the containing element (like "20%") |
Browser Support
The attribute is supported in all major browsers.
HTML img width Attribute
Reviewed by 1000sourcecodes
on
04:20
Rating: