http://webdesign.about.com/od/tables/qt/tiptablecenter.htmNow that the <center> tag is deprecated as is the align="center" attribute on table tags, how are you supposed to center your tables within your Web page? Luckily, there is a relatively easy way to do this using CSS.

Center a Table with CSS

table { margin: auto; }
When you have a table set in a Web page, or even within another block element (such as a div), you can center that table within the element by using the margin: auto; property in CSS. This property tells the browser to make the margins on all sides of the table equal. Which will, in turn, push the table into the center of the browser window.

Unfortunately, IE 6 Doesn't Support This

This is one of those standards based options that IE doesn't support. If you must design for IE, then you'll need to add in other styles for IE to center your tables.


-----------------------------------
centeredTable { margin-left: auto; margin-right: auto; }


© juroweb 2003-2014. All rights reserved
log in