Hyper Text Markup Language (HTML) Question:
Download Job Interview Questions and Answers PDF
How do I center a table?
Answer:
In your HTML, use
<div class="center">
<table>...</table>
</div>
In your CSS, use
div.center {
text-align: center;
}
div.center table {
margin-left: auto;
margin-right: auto;
text-align: left;
}
<div class="center">
<table>...</table>
</div>
In your CSS, use
div.center {
text-align: center;
}
div.center table {
margin-left: auto;
margin-right: auto;
text-align: left;
}
Download HTML Interview Questions And Answers
PDF
Previous Question | Next Question |
How do I align a table to the right (or left)? | How can I check for errors? |