Forum Moderators: mack

Message Too Old, No Replies

img height and width atributes

are they mandatory?

         

Reid

7:43 am on Sep 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a large photo gallery on my site.
I use tables. Each img is in it's own data cell.
Each img has a width attribute but no height.
these pages validate fine but I have read here and there that you MUST specify height AND width.

do you? and why?

ken_b

8:03 am on Sep 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, always, faster loading pages.

webdude

2:17 pm on Sep 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Reid,

They are not mandatory, but keb_b is right, they help the page load quicker. Some html checkers will error if you check your pages without the height and width attributes.

Besides loading faster, there is no other advantage as far as I know. I have many sites that hax\ve none of these tags and some that are left out intentionally (ie. images from a database call that have different heights and widths)

I hope this answers your question.

tbear

6:01 pm on Sep 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



One other advantage, that I can see, is that the rest of the page will not jump about as the images begin to load. That is to say, specifying width and height will determine the page layout at the outset of page loading as opposed to during the load process.
I get somewhat miffed when I begin to read/study something and it leaps to somewhere else on the page because image attributes have not been specified (as per $otmail, for example).

webdude

6:45 pm on Sep 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're right tbear, I forgot about that. Most of my sites use tables or css for positioning so the jumpimg is not an issue.

Reid

4:46 am on Sep 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanks guys I decided it is probably worth the trouble to go through and dot my i's and cross my t's.

Mr Bo Jangles

6:58 am on Sep 22, 2004 (gmt 0)

10+ Year Member



One other advantage, that I can see, is that the rest of the page will not jump about as the images begin to load. That is to say, specifying width and height will determine the page layout at the outset of page loading as opposed to during the load process.

And that is a *huge* interface/appearance issue IMO - few things look worse or detract from initial impressions for me, it tells you straight away that it was built by a novice.

webdude

1:55 pm on Sep 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have actually used the "jumping around" method to give movement to my page. In other words, I have left off the height and width attributes intentionally to create a menu and other objects that seems to slide to the left as the image loads.

tbear

6:35 pm on Sep 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>slide to the left as the image loads
LOL
That's just what happens when I have logged into $otmail and click on one of the horizontal tags before the page has fully loaded. If I'm not quick enough I hit the wrong tag.
%$/*,ª annoying in that instance. Have to be patient and wait for all the rubbish to load!
Good job it's free ;)

Matt Probert

5:32 pm on Sep 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Might I add, if a page has lots of images, then jumping to an anchor within that page from another page will often fail if the image heights, at least, are not specified, since the browser loads the text, locates the anchor, sets the display, and then adjusts the display as the images are loaded!

Yes I did get caught by this in the past! <G>

Matt

Reid

7:49 pm on Sep 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've seen that before. where the page jumps as it's loading and as you attempt to click on a usual link you end up hitting an ad.
pretty calculated move.

webdude

7:55 pm on Sep 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Okay, I'll admit. It has happened to me too. But I do not run any ads on my pages.