Center aligning a table within DIV element

Define the CSS style in css file or header of the HTML page:

div.center {
text-align: center;
}

div.center table {
margin-left: auto;
margin-right: auto;
text-align: left;
}

Here is the HTML (within BODY tag):


<div class="center">
<table><tr><td>Content in center aligned table</td></tr></table>
</div>

Share

Possibly Related posts:

Tags : , , , , ,

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Leave Comment

Freelance Jobs