Reputation: 7758
Why would the align="center" not be working on the first table on the page below:
Upvotes: 9
Views: 44902
Reputation: 406
You should use CSS selector with Attribute align="center" like below:
table[align="center"] {
margin: 0 auto;
}
Upvotes: 2
Reputation: 12142
while there are many ways to do with css, divs, and style property and stuff
the simpliest way is not to use align="center" but to wrap the table in <center> </center>
tag :)
Note: the center
element is considered obsolete in HTML5.
Upvotes: 2
Reputation: 23
there are two things you need to do
need to have width in pixel or %
margin: 0 auto; or i.e margin-left:auto & margin-right:auto
.search-box table{ height: 100%; width: 50%; margin: auto; }
Upvotes: 1
Reputation: 16091
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;
}
Upvotes: 9
Reputation: 736
You need to set this on the <td> elements.
You should also use text-align: center in css, not align="center" in html.
Upvotes: 11