Center Aligning a Table with CSS

So you want to center align a table, try text-align: center and it doesn’t work…. I have to look this up every time, so here goes:


table style="margin-left: auto; margin-right: auto;">

This is because text-align applies to inline content, not to a block-level element like a table and this article describes it in detail:

Thanks Scott Granneman for the detailed article.

No Comments