Forum Moderators: open

Message Too Old, No Replies

Horribly Annoying 100% Table Width/Height Problem

Table does not stretch completely... some times.

         

JasonIR

3:31 pm on Apr 8, 2003 (gmt 0)

10+ Year Member



I have encountered this problem several times, and I cannot figure out what is causing it. When I am designing a page, I notice that if I have any 100% width or height tables, they do not stretch completely unless it is a fresh load. For example:

If I load the page in a new browser window off my hard drive the table stretches completely.

If I load the page in an existing browser window off my hard drive, it leaves a small margin.

If I load the page online, the table stretches completely, but if I hit the back button, and then the forward button to return to the page, the margin is back again.

I'm using IE 6.0. Does anyone know the cause of this problem?

Birdman

3:40 pm on Apr 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That is a common problem that should be easy to fix by setting the parent element's margin and/or padding to 0px.

By parent, I mean whatever the table is nested in. It could be another table, a div or, most likely, the body element.

Are you using CSS at all?

JasonIR

3:54 pm on Apr 8, 2003 (gmt 0)

10+ Year Member



Hey Birdman,

The only thing I'm using CSS for is for link style. Nothing major there.

My Code:

<body background="images/cc_v2.0.2_05.jpg" text="#000000" link="#000000" vlink="#000000" alink="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="748" height="100%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="727" align="left" valign="top" bgcolor="#A2BFDD">
Content etc etc
</td>
</tr>
</table></body>

I don't understand what could possibly be causing this.

pageoneresults

4:21 pm on Apr 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hello JasonIR! Based on this code...

<table width="748" height="100%" border="0" align="left" cellpadding="0" cellspacing="0">

You do not have your table width set at 100%, it appears to be fixed at 748 pixels in width.

The table height attribute is not well supported.

JasonIR

4:48 pm on Apr 8, 2003 (gmt 0)

10+ Year Member



Hi pageoneresults,

Correct. The problem I am having is with the vertical height of a table on my page. However, I have also had this problem with horizontally stretched tables.

It seems like Netscape displays everything fine. This problem has been driving me nuts for months now.

ScottM

4:55 pm on Apr 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try removing the height callout completely?

limbo

4:56 pm on Apr 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<edit> Ignore me if I'm way off track :) </edit>

pageoneresults

5:13 pm on Apr 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



JasonIR, I took a peek at what I think is the site you are referring to. What I found is this...

You have some table widths set at "100" which means 100 pixels. That should be "100%" which should correct any issues you are having.

Also, the table height attribute is not well supported and many don't recommend its use.

axisoftime

5:28 pm on Apr 8, 2003 (gmt 0)

10+ Year Member



Don't use table height. It is one of the many things that browsers render differently. For width, you shouldn't have a problem with width="100%" as long as you've controlled the width of other td's that hold your tables. The problem with table formatting is that 1 pixel or percentage off may tank an entire group of nested tables. It has to do with the way the browser renders and calculates tables.

If you have to use tables, try formatting them with CSS - much easier to control.

JasonIR

6:21 pm on Apr 8, 2003 (gmt 0)

10+ Year Member



Thanks for all the suggestions. It turns out sticking all my CSS into an external file fixed the problem. Weird. Thanks again :)