auwall12688 auwall12688 - 1 month ago 6
HTML Question

.mainTable TD CSS not working in chrome

I have a CSS file with the following:

.mainTable
{
width:100%;
border:solid;
}

.mainTable td
{
border:solid;
text-align:center;
}


In firefox and ie all the td's now have a border and are center aligned. However chrome simply ignores it and the td's are not formatted.

Any clue as to why chrome behaves differently?

Answer

You should give the borders a width and a color, this is a much better cross browser solution.

.mainTable
{
    width:100%; 
    border: 1px solid #000;
}

.mainTable td
{
        border: 1px solid #000; 
        text-align:center;
}

The color can be whatever color you want.

You don't see the border in chrome because it has no width.