Login for Software or Support

CoffeeCup - HTML Editor, Flash & Web Design Software

Over 47,729,330 Downloads in 87 Countries

Tell a Friend About Our Cool Software

Buy the Book Here !

Chapter 2: Should You Ever Omit Width and Height?


If you want an image displayed at its normal size you can just omit width and height, right? Well, you can but you shouldn't, and here's why. You must include the height and width of an image for the page to valid HTML. Without the width and height information, the browser has to

download the entire image to know how big it is and how much space to reserve for it on the page. If you include this information in the <img> tag, the browser knows how much space to reserve before the image is downloaded and can continue rendering other page elements while waiting for the image to download. The result is a faster page download experience for your users. It's not a significant difference in all situations, but particularly with large images it can have a real effect.

While you can use the width and height attributes to display an image at a smaller than normal size, I recommend against it. It's better to use a graphics program such as Adobe Photoshop or Paint Shop Pro to make a copy of the image at the size you want it and use that. You'll save download time and your users will see faster-loading pages--always a good thing!

« Determining an Image's Pixel SizeOther <img> Tag Attributes »

Table of Contents
Download Our Software:

... and don't forget about our Free Software

CoffeeCup Home Page | Software | Copyright & Legal | Site Map | © 1996 - 2008 CoffeeCup Software, Inc.