469,628 Members | 1,049 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,628 developers. It's quick & easy.

Resetting default <IMG> HEIGHT and WIDTH attributes

If an <IMG> specifies a WIDTH but not a HEIGHT, then height is internally
determined so as to maintain the image's aspect ratio.

Aspect ratio is also preserved if HEIGHT but not WIDTH is specified.

What is the value of an unspecified HEIGHT or WIDTH attribute. How do I
dynamically set the attribute to unspecified, after having previously used
the <IMG> with explicit HEIGHT and WIDTH attributes?

- David

Jul 20 '05 #1
2 2051
David D. wrote:
If an <IMG> specifies a WIDTH but not a HEIGHT, then height is internally
determined so as to maintain the image's aspect ratio.
By reading the file itself.
Aspect ratio is also preserved if HEIGHT but not WIDTH is specified.

What is the value of an unspecified HEIGHT or WIDTH attribute.
Its undefined and the browser reads the image file to get its width
and/or height.
How do I dynamically set the attribute to unspecified, after
having previously used the <IMG> with explicit HEIGHT and WIDTH
attributes?


Simply put, you don't reliably do it. What exactly are you trying to do
though? Sounds like you are trying to make a thumbnail page where the
images swap out by resizing them??
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 20 '05 #2
Fox


"David D." wrote:

If an <IMG> specifies a WIDTH but not a HEIGHT, then height is internally
determined so as to maintain the image's aspect ratio.

Aspect ratio is also preserved if HEIGHT but not WIDTH is specified.

What is the value of an unspecified HEIGHT or WIDTH attribute. How do I
dynamically set the attribute to unspecified, after having previously used
the <IMG> with explicit HEIGHT and WIDTH attributes?
WIDTH="100%" HEIGHT="100%"

- David

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by MyndPhlyp | last post: by
9 posts views Thread by Wladimir Borsov | last post: by
5 posts views Thread by homecurr | last post: by
10 posts views Thread by News | last post: by
1 post views Thread by Carl | last post: by
4 posts views Thread by bgold12 | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.