Forum Moderators: not2easy
div #container
{display: table; margin-left: auto; margin-right: auto;}
The table still sits on the left, can anyone show me where i am going wrong.
REgards Ian
and my css isdiv #container
{display: table; margin-left: auto; margin-right: auto;}
What's that "div" before the #container?
If it's actually in the .css file, that could mess it up. Take it out.
So (to recap) container should look like this:
#container
{display: table; margin-left: auto; margin-right: auto;}
Other than that, everything looks fine. Hope this helps.
You can just apply those auto margins directly to the table, by the way, in order to center it. Note that you also need to use text-align center on the table's parent element (like your div, for instance) in order to center with IE5.x/Win. It doesn't support the auto margin thing.
One other note...
div #container
cEM
#container
{ width:750; text-align:right; margin-left: auto; margin-right: auto;}
I aligned the text right just to check the div was working, I still have the table on the left of the browser, and not centered, the table is 750px wide, i have tried with and without the gap between div and # but still no luck. Cant see where i am going wrong now?
Thanks for all help so far.
Regards
Maybe we just need a fresh start to see what's going on.
cEM
I will post my complete stylesheet and html in case someone can spot where i am going wrong,
Here's my html
<body>
<div id="container">
<table width="750" border="2" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="21"> </td>
<td> </td>
<td> </td>
</tr>
</table>
<p> </p>
</div>
</body>
Here's my stylesheet
body {
background-color: #666666; align: center;
}
#container
{ width:750px; text-align:right; margin-left: auto; margin-right: auto;}
Regards
Ian