Forum Moderators: open

Message Too Old, No Replies

Table question

I can't believe I'm asking this...

         

pcguru333

1:16 pm on Mar 26, 2002 (gmt 0)

10+ Year Member



The last 24 hours I have been banging my head on the simplest issue.

Can someone please assist me in setting table row and column attributes so that the height of each row is specified?

I have a table that has several nested tables in it. The top two rows of the main table had specific heights of 65 px and 3 px (I am lining up images). These tops rows were behaving. The rest of my rows and the rows of my nested tables weren't. As I messed with the table trying to line up images and the spacing I desired the top two rows (which I didn't touch) stop behaving. Now all my column widths are fine but my heights have gaps.

I have tried putting in attributes everywhere (even places I know they don't go) to the point that I have confused my self and my code is probably mush.

Any suggestions?

lazerzubb

1:21 pm on Mar 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<table width="63" border="0" cellspacing="0" cellpadding="0" height="3">
<tr>
<td> </td>
</tr>
</table>

Is this what you wanted ?

tedster

1:29 pm on Mar 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One issue is that Netscape 4 sizes the table cell height to the minimum height needed for the content.

What I do at times is to create an extra table column and fill its cells with spacer gifs - of the height I want to maintain for each row. That way no browser will collapse the height of the row to a minimum. And I don't need any attributes then, either.

pcguru333

1:30 pm on Mar 26, 2002 (gmt 0)

10+ Year Member



Thanks for the reply. I must be doing something wrong further down in my code, because I have specified heights in the table tag (i believe the HEIGHT attribute is deprecated, but I just want to get it to work). I have tried using the heights attribute in the <TR> and <TD> tags as well. Would it be easier if I put a snippet of my code here?

pcguru333

1:33 pm on Mar 26, 2002 (gmt 0)

10+ Year Member



Tedster thanks. My problem is that IE isn't collapsing to the size of my content. I have several GIFs and JPEGs that I am lining up and I specify the height and width of each image in the IMG tags. My widths are working fine my heights are not collapsing but are leaving gaps (even when I tell it to valign=top) my images are setting in each cell about 3/4 of the way from the top.

I am totally confused

knighty

1:40 pm on Mar 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you have gaps above your images even though valign=top

1) check there are no <P> or <BR> tags in between the image
2) check your cellpadding and cellspacing are set low

pcguru333

1:45 pm on Mar 26, 2002 (gmt 0)

10+ Year Member



Here is a snippet of code from one of my nested tables (all my tables form the top down are coded in the same manner and are behaving in the same way.) I am using IE 6 at home on Win XP. I am currently at work and seeing the same result using IE 5 on Win NT 4.0.

<table summary="Button Table" cellpadding="0" cellspacing="0"
height="270">
<tr>
<td width="160" height="45" align="center" valign="top"><img src=
"images/Home_Button.gif" width="140" height="45" alt=
"Home_Button.gif (1K)" /> </td>
</tr>

<tr>
<td width="160" height="45" align="center" valign="top"><img src=
"images/Newsletter_Button.gif" width="140" height="45" alt=
"Newsletter_Button.gif (1K)" /> </td>
</tr>

<tr>
<td width="160" height="45" align="center" valign="top"><img src=
"images/Mission_Button.gif" width="140" height="45" alt=
"Mission_Button.gif (1K)" /> </td>
</tr>

<tr>
<td width="160" height="45" align="center" valign="top"><img src=
"images/Hunting_Button.gif" width="140" height="45" alt=
"Hunting_Button.gif (1K)" /> </td>
</tr>

<tr>
<td width="160" height="45" align="center" valign="top"><img src=
"images/Fishing_Button.gif" width="140" height="45" alt=
"Fishing_Button.gif (1K)" /> </td>
</tr>

<tr>
<td width="160" height="45" align="center" valign="top"><img src=
"images/Homestay_Button.gif" width="140" height="45" alt=
"Homestay_Button.gif (1K)" /> </td>
</tr>

<tr>
<td width="160" height="1" valign="top"><img src=
"images/Dk_Green_dot.gif" width="160" height="1" alt=
"Dk_Green_dot.gif (1K)" /> </td>
</tr>

<tr>
<td width="160" align="center" valign="top">insert contact info
here</td>
</tr>
</table>

tedster

2:06 pm on Mar 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Get rid of the space between the end of the image tag and the </td>

Right now you have:
<img> </td>

Change it to
<img></td>

pcguru333

4:06 pm on Mar 26, 2002 (gmt 0)

10+ Year Member



Tedster thank you. I learned that a long time ago (I never heard an explanation why it does that as whitespace should be ignored).

I am using a new HTML Editor and it must have thrown those blasted spaces in when I 'TIDY'd

The fix worked and my website is happy again :)

[BTW I tried to post this 50 gazillion times and I was erroring out, sorry for the delated response]

tedster

4:23 pm on Mar 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Interestingly, Opera 6 rendered your original code correctly too!