...

View Full Version : Inserting images to fit into table cells?



lana2000
02-27-2009, 01:46 PM
Hi everyone,

I was wondering if anybody could help me to be able to properly "fit" a few jpg/gif images into a 5x6 table with each image in one cell but I want to keep the table's shape fixed with all the images been nicely fit into the cells without resizing the cells that is to stretch images to fit table cells.

To be clear, I've took a snapshoot of what I currently have below:

http://i693.photobucket.com/albums/vv300/test_012/test.jpg

and I want to see something like (see the middle of the page) :

http://www.biriz.biz/

How can I do this, I already tried a couple things
1. by using 100% for the image size,
2. putting the images into the cell's background.

But it doesn't work for me,

Any help is greatly appreciated ....

Thanks,

Donkey
02-27-2009, 02:02 PM
You should change the size of the images so that they fit the table cell size you want.

lana2000
02-27-2009, 02:15 PM
You should change the size of the images so that they fit the table cell size you want.

You mean changing the size of the actual images manually? if so then yes, that would work, or perhaps you mean to changing the size in the html-code which still work fine, however I was thinking if there is a way to fix the width and height of the table which that may force the contents of the cells to re-size itself dynamically to fit into the table's cells on-fly but I am not sure if such thing is exist at all.

I guess I am just too lazy to re-size all the images manually ....

jerry62704
02-27-2009, 02:23 PM
You either have to restrict the width/height of the table cell or of the image. A table cell will grow to the specified size of the content or the restricted size given it.

lana2000
02-27-2009, 02:49 PM
You either have to restrict the width/height of the table cell or of the image. A table cell will grow to the specified size of the content or the restricted size given it.

Should I specify the width & height for each individual cell ? perhaps you mean something like
<td width="N-px" height="M-px"><img src="image.jpg"></td>
I will try this, but if all the cells are of the same width N and the same height M then is there a way to just specify this N & M once in the main table and in this case we do not have to specify this for each individual cell.

jerry62704
02-27-2009, 07:18 PM
If you have 3 cells across the page, they will all be as large as the largest one. If you want them to all be the same size regardless, then put a width and height on the img. Your syntax is off, but I'm assuming it was just a short hand thing.

css:
td { width:xxpx; height:yypx;}
and / or
img {width:xxpx; height:yypx;}

You know how to put that css in the header section or in a style sheet?

If you are going to use tables, you are going to include all the accessibility tags tables need, right?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum