Burt
Burt

Reputation: 7758

Table align="center" doesn't seem to be working

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

Upvotes: 9

Views: 44902

Answers (5)

kollein
kollein

Reputation: 406

You should use CSS selector with Attribute align="center" like below:

table[align="center"] {
    margin: 0 auto;
}

Upvotes: 2

max4ever
max4ever

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

sandesh mahajan
sandesh mahajan

Reputation: 23

there are two things you need to do

  1. need to have width in pixel or %

  2. margin: 0 auto; or i.e margin-left:auto & margin-right:auto

    .search-box table{ height: 100%; width: 50%; margin: auto; }

Upvotes: 1

Sascha Galley
Sascha Galley

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

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

Related Questions