Table with 100% width relative to parent div

JavaScript and client side scripting.

Moderator: General Moderators

Table with 100% width relative to parent div

Postby Nathaniel » Wed Jul 19, 2006 8:11 am

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:

Syntax: [ Download ] [ Hide ]
<div>

<table>

<tr>

<td>Blah</td>

</tr>

</table>


And then I have this CSS:
Syntax: [ Download ] [ Hide ]

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
Nathaniel
Forum Contributor
 
Posts: 396
Joined: Wed Aug 31, 2005 5:58 pm
Location: Arkansas, USA

Postby Benjamin » Wed Jul 19, 2006 3:13 pm

Try setting the width of the parent div.
Image
User avatar
Benjamin
Site Administrator
 
Posts: 6862
Joined: Sun May 19, 2002 10:24 pm


Return to Javascript

Who is online

Users browsing this forum: No registered users and 0 guests