Vertically and horizontally centralize HTML table
The HTML code below highlights how to center a table vertically and horizontally on a webpage.
Click here to test the HTML code below.
<html> <head> <style type="text/css"> .box { width:300px; height:300px; background-color:#d9d9d9; position:fixed; margin-left:-220px; /* half of width */ margin-top:-150px; /* half of height */ top:50%; left:50%; } </style> <title>Xybernetics Products Table</title> </head> <body> <table class="box"> <tbody> <tr> <th>Device</th> <th>IP Address</th> <th>Specifications</th> </tr> <tr> <td>XynetSCADA uCFlowCal</td> <td>192.168.2.188</td> <td>http://www.xybernetics.com/solutions-uCFlowCal.html</td> </tr> <tr> <td>uCMobile HMI</td> <td>192.168.2.221</td> <td>http://www.xybernetics.com/solutions-uCMobileHMI.html</td> </tr> </tbody> </table> </body> </html>