Why would the align="center" not be working on the first table on the page below:
http://eurochlor.amaze.com/chlorinated-solvents-%28ecsa%29/about-chlorinated-solvents/facts-figures/trichloroethylene.aspx
Why does Align Center doesn't work? Short answer: your text isn't centered because the elements are floated, and floated elements "shrink" to the content, even if it's a block level element.
We use the CSS property text-align, to center align text in table cells. We use inline, internal style sheet for text alignment in table cells. The text-align property of CSS sets the alignment of the content in <th> and <td>. By default, the content of <th> are center-aligned and the content of <td> are left-aligned.
HTML | <th> align Attribute right: It sets the text right-align. center: It sets the text center-align. justify: It stretches the text of paragraph to set the width of all lines equal. char: It sets the text-align to a specific character.
Table data defaults to left alignment; table headers to center. In order to change the alignment in one cell, insert the appropriate "ALIGN=" attribute within the code for that cell. In order to change the alignment in all cells in a row, insert the appropriate alignment attribute within the code for that row.
If you want to have the table centered use:
.content-table {
margin: 0 auto;
}
if you want to have the td text centered use:
.content-table td {
text-align: center;
}
You should use CSS selector with Attribute align="center" like below:
table[align="center"] {
margin: 0 auto;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With