|The Unix and Internet Fundamentals HOWTO, by Eric Raymond|
|Center a table with CSS||Search for a title, author or keyword|
Center a table with CSS
The problem: the old way to center a HTML table was easy: table align=center. The align attribute has been deprecated, however, in favor of CSS ( Cascading Style Sheets ), and this is a good thing. However, it's not so obvious how to center a table using CSS. As stated in W3C Recommendation, deprecated elements may become obsolete in future versions of HTML. To center a table with CSS, you need some clever tricks. Centering of the table in CSS works by setting the left and right margins of the space around the table to "auto". A browser that implements Cascading Style Sheets correctly will resize the table so that the left and right margins around the table are equal. This effectively causes your table to be centered. Since Internet Explorer does not correctly follow the standards here, we had to resort to a series of tricks. In this article, written by Scott Granneman, you will find three simple tricks to achieve our goal.
|Center a table with CSS||Disclaimer: this link points to content provided by other sites.|