Table with 100% width relative to parent div

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Nathaniel
Forum Contributor
Posts: 396
Joined: Wed Aug 31, 2005 5:58 pm
Location: Arkansas, USA

Table with 100% width relative to parent div

Post by Nathaniel »

A work-around for this has to be documented somewhere, but I have been googling for half an hour and I'm stuck. Basically, I have a table inside a div:

Code: Select all

<div>
<table>
<tr>
<td>Blah</td>
</tr>
</table>
And then I have this CSS:

Code: Select all

div
{
	margin-left: 21em;
	margin-right: 9em;
}

table
{
	width: 100%;
}
I want the table to be 100% of the width of the div tag, not the browser window. In Firefox it's all well and dandy, but not in IE6. What do I do about it?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Try setting the width of the parent div.
Post Reply