Resetting default <IMG> HEIGHT and WIDTH attributes

D

David D.

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
 
R

Randy Webb

David said:
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??
 
F

Fox

David D. said:
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%"
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top