How center that table?
Jul 24, 2017 · 1 min read
Table align doesnt work anymore…
To center a table the old code below doesnt work anymore because the “align” attribute has been deprecated in favor of CSS — Yeahhhhh!
<table align="center">
...
</table>However things are not a bit, bit more complex. So the solutions are:
Set the margins and give the table a class — Mozilla and Opera
CSStable.center {
margin-left:auto;
margin-right:auto;
}---------------------
HTML <table class="center">
...
</table>
For Internet Explorer 5.5 add to the CSS
body {text-align:center;}To make the table fixed width use the following CSS
CSSdiv.container {
width:98%;
margin:1%;
}
table.tableA {
text-align:center;
margin-left:auto;
margin-right:auto;
width:468px;
}tr,td {text-align:left;}---------------------<div class="container">
<table class="tableA">
...
</table>
</div>
Source: Scott Granneman, 2017