On 21 Oct 2005 13:00:08 -0700, "yb" <ba*********@ya hoo.ca> wrote:
is the following html markup:
<img src="xyz.jpg" width="100" height="100" alt="whatever" />
equivalent to:
<img src="xyz.jpg" style="width : 100px; height : 100px;"
alt="whateve r" />
i.e. is setting width and height as attributes for img the same as
setting it in the style sheet?
Not quite. Often they will produce the same results, but not always.
Firstly, if you have non-zero margin and/or padding set on img elements,
the results may be different (I can't immediately recall which browsers
do what).
Secondly, using the first method enables browsers to quickly render
pages with several images, because they know how much space to reserve.
I don't think this is true of the second method - at least not for all
browsers.
Thirdly, if you have other CSS definitions which interact with these,
they may end up at different positions in the cascade. (I suppose this
may be a generalisation of my first point).
--
Stephen Poley
http://www.xs4all.nl/~sbpoley/webmatters/