Archived topic
Centering a table
5 replies · Started by John on September 10, 2021
Hi,
Any suggestions about how to center a form on the following page?
The form is in the middle of the page, below the heading: Leave your name and email here in this form,
If I inspect the page and uncheck the following, the form centers.
caption, td, th {
font-weight: 400;
text-align: right;
padding: 5px;
}
How are these attributes turned off?
Thanks!
Hi John,
Try add this CS:
.simple td {
text-align: -webkit-center;
}
Let me know if this helps :)
Hi Ying,
Your solution worked perfectly until I changed the table dimensions and reuploaded the HTML form.
Now the form is floating left again. :(
I cleared both the server and browser cache.
Would you please take another look?
Thank you!
Let's try this CSS instead:
div#mainContent > table > tbody > tr > td {
display: flex;
justify-content: center;
}
Let me know :)
Thank you. That worked.
If another table were ever added to this page, this CSS would center that additional table too. Is that correct?
I'm not sure, it depends on what's the id of the table.
In this case, the id is mainContent.
You can try this one, it's more likely work for other forms:
table > tbody > tr > td {
display: flex !important;
justify-content: center !important;
}