always give image dimensions WIDTH= HEIGHT=

J

Jbj4712

You know when you're click ing on a link, and the link sinks down suddenly on
the page, because an image higher on the page expands? You may even click on a
link higher on the page, because it is now directly under your mouse arrow.

Avoid this on nyour pages. Always give the dimensions in the IMG tag, as in

IMG SRC="logo.gif" HEIGHT="173" WIDTH="385"

This tells the browser how much space to allow for the image, even before the
image file downloads. Links lower on the page don't jump down.
 
N

Neal

Always give the dimensions in the IMG tag, as in

IMG SRC="logo.gif" HEIGHT="173" WIDTH="385"

Excellent tip, but beware of situations where the stylesheet hasn't loaded
and this can cause unexpected jumping too.

In IE, this can happen (http://www.bluerobot.com/web/css/fouc.asp) unless
you include a <link> element in your head, so even if you just import the
stylesheet, link something too.

This happens in Opera for me too, I don't know a workaround for it.
 
S

Spartanicus

Neal said:
but beware of situations where the stylesheet hasn't loaded
and this can cause unexpected jumping too.

In IE, this can happen (http://www.bluerobot.com/web/css/fouc.asp) unless
you include a <link> element in your head, so even if you just import the
stylesheet, link something too.

This happens in Opera for me too, I don't know a workaround for it.

Opera Preferences, Windows, Loading, increase the value to reduce the
FOUC effect.
 
R

Robert Frost-Bridges

Karl said:
<snip crap>

Please do not give anymore advice on HTML.
Ever.

That seems a bit harsh, it was a fair enough tip even if it wasn't
anything new to a lot of people in here.

And anyway, it quickly developed into a little tip for Opera as well so
there you go.
 
N

Neal

Please do not give anymore advice on HTML.
Ever.

Come on, Karl! To a complete newbie, it is a good tip. It's neither
incorrect nor controversial; it's, at worse, painfully obvious.

Shouldn't we be encouraging the new folks who are just starting out? I
think so.
 
K

Karl Core

Neal said:
Come on, Karl! To a complete newbie, it is a good tip. It's neither
incorrect nor controversial; it's, at worse, painfully obvious.

Shouldn't we be encouraging the new folks who are just starting out? I
think so.

Actually, I would have applauded if the OP had given his advice in terms of
dictating IMG size with CSS.

-Karl
 
M

Mark Parnell

Actually, I would have applauded if the OP had given his advice in terms of
dictating IMG size with CSS.

Why? Surely the width and height of the image is part of its content?
And using CSS to set the width and height won't achieve the same result
that the OP was promoting, as the browser won't know the dimensions of
the image until the CSS file is loaded.
 
N

Neal

Actually, I would have applauded if the OP had given his advice in terms
of
dictating IMG size with CSS.

What if the UA has no CSS support or has it hidden through @import, or the
document uses no CSS (and even no table markup, font, etc.)? The jump will
exist. I can't agree.
 
R

rf

Karl said:
Actually, I would have applauded if the OP had given his advice in terms of
dictating IMG size with CSS.

Which will result in even more rules in the (probably already bloated) CSS
that pertain to a single element. If CSS *is* used than an inline style is
indicated.

Besides the size of an image is physically part of that image, it is not a
presentational issue about that image. The size does not (or should not)
change.
 
N

Nik Coughin

Karl said:
Actually, I would have applauded if the OP had given his advice in
terms of dictating IMG size with CSS.

-Karl

Why? Width and height are valid attributes for the img element using HTML
4.0 Strict. If you are talking about seperating content from presentation,
sure, any *changes* to the img's inherent size should be specified in the
presentation layer, CSS. In this case the OP is talking about using the img
tag's existing height and width (in order that the browser lay the page out
correctly before all images are loaded).

Surely in this instance the image's *inherent* height and width are an
attribute of content and not presentation, and therefore using CSS is
inappropriate for this. Note that the specs say that attributes concerning
alignment and presentation have been deprecated in favour of style sheets,
but the width and height attributes have not. It also says:

"The height and width attributes give user agents an idea of the size of an
image or object so that they may reserve space for it and continue rendering
the document while waiting for the image data."
 
E

Eric B. Bednarz

rf said:
Which will result in even more rules in the (probably already bloated) CSS
that pertain to a single element.

If you are rather clueless about doing it, certainly, but it's not
mandatory to inflict that limitation upon Garp and the world as well.
Otherwise the opposite would be true in most sensible scenarios.
Besides the size of an image is physically part of that image, it is not a
presentational issue about that image.

That's a funny statement to back up an argument which addresses *nothing
but* a presentational issue.
The size does not (or should not)
change.

That's a reason not to specify any dimensions, neither with HTML
attributes nor CSS properties, since you *cannot* specify the physical
dimensions of an image with them per specification (it's a simple matter
of RTFM instead of parroting common amusenet wisdom).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top