[thelist] Image Size Included in Image Tag

Scott Brady evolt at scottbrady.net
Thu Dec 11 13:08:09 CST 2003


Original Message:
> From: "Brian W. Reaves" <brian at brianreaves.com>

> If I create an image to the size I want it, are there any reasons why I 
> have to include the "height & width" of the image in the "img" tag?
> 
> EX:
> <img src="images/image1.jpg" alt="Image" title="Image" />
> vs.
> <img src="images/image1.jpg" height="150" width="150" alt="Image" 
> title="Image" />

Without the height and width, the browser doesn't how much space to allow for the image until the image has finished loading.  So, while the page is loading, you will get the layout "jumping" around as images get loaded.  It doesn't really affect the final layout ( to my knowledge ), but it's a bit disconcerting for users (particularly if they're trying to read part of the page while the page is still loading).

There may be other disadvantages to not listing those attributes, as well, but I'm not certain what those would be.

Scott
----------------------------
Scott Brady
http://www.scottbrady.net/




More information about the thelist mailing list