Html table not displaying table properly why is it pushed to the side

Viewed 24

My table is stuck to the side. there is a image attached 1: https://i.stack.imgur.com/ZCVcG.png

 <table border="1" class="table2">
                <tr>
                    <th>Occupation</th>
                    <td scope="col">space</td>
                </tr>
</table>
2 Answers

Set maring:0px auto; to your parent class of table. It will push it to center

If you are developing a site you can use margin-left: auto; margin-right: auto; on the table itself. If you are developing an email, the better solution is to add align="center" attribute (do not confuse it with text-align: center CSS declaration) to the table tag. This attribute applied to the table centers the table itself, not its content.

Related