To center table using CSS only
To center table using CSS only according CSS specification the following code should be used:
margin-left : auto;
margin-right : auto;
This code perfectly works in firefox, opera, netscape and I guess in other browsers :). But when you open such centered table in IE (even IE 7) you may see that table has no alignment. It means that you didn’t declare “DOCTYPE” for your HTML document.
Without a “DOCTYPE” declaration, IE ignore margins definition for block level elements.
So, just add following at beginning of your document:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">