HighDots Forums  

keep aspect ration of images in html tables

alt.html.webedit alt.html.webedit


Discuss keep aspect ration of images in html tables in the alt.html.webedit forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Stefan
 
Posts: n/a

Default keep aspect ration of images in html tables - 01-06-2004 , 10:32 AM






Hello all,
I have the following problem:
I want to create a table with three rows and two columns in html which
contains in each cell three additional rows. In the first additional
row I want to display an image in the second and third row some text.
Now the question:
The image I want to display should keep the correct aspect ration but
should also use the whole available space in the cell. So this means
that the image may be resized in width or height (or both if width and
height are identical). How can I manage this without using absolute
height and width for the table cells?
I know that I can leave out the width (or height) parameter for the
image and that the IE scale the missing paramter automatically to the
correct value to keep the aspect ratio. But then I have to know, which
parameter can be left out (width or height).
I must also say, that I did not know the width and height of the image
at the time I want to display it. If so, I can calculate the correct
width and height by Javascript.
Is there a solution for this problem (e.g. a html parameter
"keepaspectration" or something like this?) Or is it easily possible
to retrieve the width and height of the image?

Best regards and thanks in advance
Stefan

Reply With Quote
  #2  
Old   
Stefan
 
Posts: n/a

Default Re: keep aspect ration of images in html tables - 01-14-2004 , 04:59 AM






"Paul Wötzel" <chef (AT) pp-page (DOT) de> wrote

Quote:
It doesn't matter which attribute you leave out (width or height) ... always
use height="100%" and there will be no problem with aspect ration.
Hello Paul,
First I want to thank you for your reply.
But I have forgotten to mention that the cells of the table should
have a fixed width and height. The requirement is, that six cells (two
columns and three rows) fit on a A4 format (we need this for a report
which should have a fixed layout).
Then you have two possibilies:
Width of image is greater than height: use width="100%"
Height of image is greater than width: use height="100%"
If you do not, the cells will be expanded and then the six cells do
not fit on the A4 -> Problem here is that you need to know the
dimensions of the image which is not available!
Best regards
Stefan


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.