CSS Help Pile » Thread.

Center a table with CSS

Feb. 20, 04 • Simple Tips & How To1 comment

Some different techniques for centering tables (sometimes yer data needs a table - it's true). This is expecially useful when trying to style older markup in a redesign project, as I discovered recently. One method I'm particularly fond of applies a few simple attributes to the
table element like this:

table.center { width:70%; margin-left:15%; margin-right:15%; }

So, the width % + margin-left % + margin-right % always equal 100% and you're good to go with a simple centered table.  Very useful.

Search the CSS Help Pile

Categories