<?xml version="1.0" encoding="utf-8"?><!-- generator="wordpress/1.5" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Full width tables using CSS?</title>
	<link>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css</link>
	<description>Web Development, Classical Music, Kitties, and whatever else I feel like</description>
	<pubDate>Tue, 06 Jan 2009 00:28:21 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5</generator>

	<item>
		<title>by: Andrew</title>
		<link>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-185</link>
		<pubDate>Tue, 10 Aug 2004 23:09:14 -0700</pubDate>
		<guid>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-185</guid>
					<description>Nothing like a good impossible problem to have me puzzling for a while late-night.

I tried two things that might save you time if you're still working on this problem. First, I decided that if you didn't need the border around the table, you could set the padding on the table, and that would avoid the overlap problem. Because the issue is with the width of the table's box being set the same as the total width of the containing box. If there's no margin to make life hard, then it ends up being the same; then the padding pushes the content in by x pixels.

In IE, as an aside, it calculates the widths incorrectly, so in this case it works fine with the table's width set to 100%. Instead of setting the width to 100% of the containing box's total width, it pushes the table out as far as it can go before it bumps into something.

Deciding that the border might be important, I decided to give one last thing a try. Set the width dynamically after rendering via javascript. Probably not acceptable as a solution, but it sounded interesting to try!

Unfortunately, in the 20 minutes I thought I'd budget for that solution, I couldn't come up with a reliable way to actually get the &lt;i&gt;rendered&lt;/i&gt; width of the containing div so I could set the width of the table appropriately.

So I gave up. I'm tired.

Those were my thoughts.

Now if you would kindly refrain from pointing out horrible box model problems while I'm just warming up to my new client-side coding job at work, that would be great. You're stressing me out. :-)</description>
		<content:encoded><![CDATA[	<p>Nothing like a good impossible problem to have me puzzling for a while late-night.</p>
	<p>I tried two things that might save you time if you&#8217;re still working on this problem. First, I decided that if you didn&#8217;t need the border around the table, you could set the padding on the table, and that would avoid the overlap problem. Because the issue is with the width of the table&#8217;s box being set the same as the total width of the containing box. If there&#8217;s no margin to make life hard, then it ends up being the same; then the padding pushes the content in by x pixels.</p>
	<p>In IE, as an aside, it calculates the widths incorrectly, so in this case it works fine with the table&#8217;s width set to 100%. Instead of setting the width to 100% of the containing box&#8217;s total width, it pushes the table out as far as it can go before it bumps into something.</p>
	<p>Deciding that the border might be important, I decided to give one last thing a try. Set the width dynamically after rendering via javascript. Probably not acceptable as a solution, but it sounded interesting to try!</p>
	<p>Unfortunately, in the 20 minutes I thought I&#8217;d budget for that solution, I couldn&#8217;t come up with a reliable way to actually get the <i>rendered</i> width of the containing div so I could set the width of the table appropriately.</p>
	<p>So I gave up. I&#8217;m tired.</p>
	<p>Those were my thoughts.</p>
	<p>Now if you would kindly refrain from pointing out horrible box model problems while I&#8217;m just warming up to my new client-side coding job at work, that would be great. You&#8217;re stressing me out. <img src='http://jennifergrucza.com/blog/wp-images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Jennifer Grucza</title>
		<link>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-186</link>
		<pubDate>Wed, 11 Aug 2004 19:39:09 -0700</pubDate>
		<guid>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-186</guid>
					<description>Hi Andrew,

That's interesting, I never even thought to apply padding to the table itself.  I would've thought it would mess up the display, or do nothing at all.  I'll have to try it out.

I've written javascript like what you describe before, to create a scrollable table (that would work in IE) at a previous job.  Not the most fun thing to write, and not worth it, I think, unless you're trying to do something fancy like a scrolling table.  :)</description>
		<content:encoded><![CDATA[	<p>Hi Andrew,</p>
	<p>That&#8217;s interesting, I never even thought to apply padding to the table itself.  I would&#8217;ve thought it would mess up the display, or do nothing at all.  I&#8217;ll have to try it out.</p>
	<p>I&#8217;ve written javascript like what you describe before, to create a scrollable table (that would work in IE) at a previous job.  Not the most fun thing to write, and not worth it, I think, unless you&#8217;re trying to do something fancy like a scrolling table.  <img src='http://jennifergrucza.com/blog/wp-images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Matthom</title>
		<link>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-190</link>
		<pubDate>Tue, 24 Aug 2004 13:21:14 -0700</pubDate>
		<guid>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-190</guid>
					<description>It's interesting that you mention this problem.


I have never really been confronted with this problem, becuase usually I already have padding on the outside DIV, and the inner table doesn't need any. 

(I suppose if I tried what you mentioned, I would run into the same issue)

In general, I do notice that tables act goofy while inside divs. 

&quot;Cellspacing&quot; is the only attribute I leave in the TABLE tag, because there is no current CSS support for cellspacing. But sometimes when I change the value of that attribute, the table does goofy things.

Divs and tables don't mix very well.

I'm sure there will be better support for tables in later versions of CSS.</description>
		<content:encoded><![CDATA[	<p>It&#8217;s interesting that you mention this problem.</p>
	<p>I have never really been confronted with this problem, becuase usually I already have padding on the outside DIV, and the inner table doesn&#8217;t need any. </p>
	<p>(I suppose if I tried what you mentioned, I would run into the same issue)</p>
	<p>In general, I do notice that tables act goofy while inside divs. </p>
	<p>&#8220;Cellspacing&#8221; is the only attribute I leave in the TABLE tag, because there is no current CSS support for cellspacing. But sometimes when I change the value of that attribute, the table does goofy things.</p>
	<p>Divs and tables don&#8217;t mix very well.</p>
	<p>I&#8217;m sure there will be better support for tables in later versions of CSS.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Jennifer Grucza</title>
		<link>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-191</link>
		<pubDate>Tue, 24 Aug 2004 14:59:28 -0700</pubDate>
		<guid>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-191</guid>
					<description>Actually, CSS does provide a way to get cellspacing, but it appears that IE doesn't support it.

To get a cellspacing of 10 pixels on a table, you'd simply use a rule like this:

&lt;code&gt;table {
    border-collapse:separate;
    border-spacing:10px;
}&lt;/code&gt;

Works nicely in Firefox and Opera.</description>
		<content:encoded><![CDATA[	<p>Actually, CSS does provide a way to get cellspacing, but it appears that IE doesn&#8217;t support it.</p>
	<p>To get a cellspacing of 10 pixels on a table, you&#8217;d simply use a rule like this:</p>
	<p><code>table {<br />
    border-collapse:separate;<br />
    border-spacing:10px;<br />
}</code></p>
	<p>Works nicely in Firefox and Opera.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Richard@Home</title>
		<link>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-194</link>
		<pubDate>Thu, 26 Aug 2004 05:56:27 -0700</pubDate>
		<guid>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-194</guid>
					<description>or you could try:

&lt;div style&quot;border:1px solid black; width:400px; padding: 10px;&quot;&gt;
&lt;table style&quot;border:1px solid blue; width: 100%;&quot;&gt;
&lt;tr&gt;&lt;td&gt;Table&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;

(I added the padding to the div - not the table ;-)

Demo here -&gt; http://richardathome.no-ip.com/examples/full_width_tables/index.php</description>
		<content:encoded><![CDATA[	<p>or you could try:</p>
	<div style"border:1px solid black; width:400px; padding: 10px;">
	<table style"border:1px solid blue; width: 100%;">
	<tr>
<td>Table</td>
</tr>
	</table>
	</div>
	<p>(I added the padding to the div - not the table <img src='http://jennifergrucza.com/blog/wp-images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
	<p>Demo here -> <a href='http://richardathome.no-ip.com/examples/full_width_tables/index.php'>http://richardathome.no-ip.com/examples/full_width_tables/index.php</a>
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Richard@Home</title>
		<link>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-195</link>
		<pubDate>Thu, 26 Aug 2004 05:57:18 -0700</pubDate>
		<guid>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-195</guid>
					<description>gahhh - my bad - forgot to escape my html (blush) - view source on the demo.</description>
		<content:encoded><![CDATA[	<p>gahhh - my bad - forgot to escape my html (blush) - view source on the demo.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Jennifer Grucza</title>
		<link>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-196</link>
		<pubDate>Thu, 26 Aug 2004 11:16:00 -0700</pubDate>
		<guid>http://jennifergrucza.com/blog/archives/2004/08/10/full-width-tables-using-css#comment-196</guid>
					<description>Yeah, I knew that would work, but in this case I didn't want to pad the div, because I wanted to be able to have some contained elements span the whole width of the div, going right up to the edge.

&lt;blockquote&gt;You could choose to pad your container instead of using a margin on the table, but sometimes you need that container to not have any padding for other reasons.&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[	<p>Yeah, I knew that would work, but in this case I didn&#8217;t want to pad the div, because I wanted to be able to have some contained elements span the whole width of the div, going right up to the edge.</p>
	<blockquote><p>You could choose to pad your container instead of using a margin on the table, but sometimes you need that container to not have any padding for other reasons.</p></blockquote>
]]></content:encoded>
				</item>
</channel>
</rss>

