Click to See Complete Forum and Search --> : table formatting in html


Strogian
02-11-2004, 09:44 AM
here's what i'm trying to accomplish:


---------------------------------
| | |
| | |
+-----+------------------+------+
| | |
| | |
+-----+------------------+------+
| | |
| | |
---------------------------------


that is, a three-column table, but one of the cells (either on the right or left, alternating) takes up two of them. The middle cell should be the largest. The small cell should only contain a small picture.

here's what I'm doing right now:

<TABLE BORDER=0 CELLSPACING=10>
<COL WIDTH="10%">
<COL WIDTH="80%">
<COL WIDTH="10%">
<TR>
<TD COLSPAN=2>blah blah blah...
<TD><img ...>

but having the percents seems like a bad way to do it, because it might not work as well on different resolutions. Is there any way to get it to just reserve enough space for columns 1+3 to hold the pictures? I bet I could specify them directly:

<TABLE BORDER=0 CELLSPACING=10>
<COL WIDTH=100>
<COL>
<COL WIDTH=100>
<TR>
<TD COLSPAN=2>blah blah blah...
<TD><img ...>

but then if I use different sized pictures, i have to manually change the column widths.

EDIT: NEVERMIND THAT DOESN'T WORK.. I HATE THIS !!
It seems to want to reserve all the space it can for column 3, even though it would work perfectly to only make it 100 pixels wide.

EDIT AGAIN: THIS IS RETARDED

<TABLE BORDER=0 CELLSPACING=10>
<COL WIDTH=116>
<COL WIDTH=400>
<COL WIDTH=116>
<TR>
<TD COLSPAN=2>blah blah blah...
<TD><img ...>

you'd think that would make column 1 116 pixels wide, column 2 400 pixels wide, and column 3 116 pixels wide.. but it DOESN'T!! not in IE anyway! (netscape works fine...) In IE, I get a 116-pixel column, then probably a 0-width column, and finally another column that's, maybe, 516 pixels wide! what is going on???

Grizzly
02-11-2004, 10:02 AM
Like anything there's more than one way to skin a cat. Here are two possible approaches (http://grizz.dhs.org:81/sharky_table.htm) that first come to mind.

Hopefully you can use these as guidelines and get what you're shooting for. Best of luck.

Handyman
02-11-2004, 06:30 PM
Grizzly's ways are probably the better way to go, but I used to accomplish what you describe by setting a fixed width to those cells that I wanted fixed and then set the 'expandable' one to "width=*" which just filled in the rest of the page to 100%.

Strogian
02-11-2004, 07:27 PM
Oh yeah, now I see what's going on. In my examples, I didn't actually have anything in the second column by itself. I still think that it *should* apply the formatting I specify with the <COL> tags, but what are you going to do...

thanks for the help!