How To Center Align HTML Table

In this tutorial we will see How To Center Align HTML Table. We have used simple margin-left and margin-right CSS properties to center align HTML Table.


Write HTML Code of HTML Table, simple example is given below.

<table class="center">

CSS Code

CSS Code is given below. Simple margin-left and margin-right properties of CSS are used to center align the HTML Table. You can also add text-align:center; to center align the text of table as well.

margin-left: auto;
margin-right: auto;


Firstname Lastname Phone
Tom Harry 87932
Sara David 69123

Video Tutorial

Watch video tutorial on How To Center Align HTML Table.