Centering Table Header

Hello all,

I am attempting to center the header, a <th> element, in my test table, and I have tried the following methods of doing so:

The obsolete align attribute…


<table class="reviewtable" cellpadding="0" cellspacing="0" align="center">

& the text-align property…


.reviewtable th{
	text-align:center;
}

I’ve even tried default margins and padding…


.reviewtable th{
        margin:0 auto;
        padding:0;
}

What seems to be impeding me from centering the header? :confused:

Thanks,

Tyler :smiley: :rolleyes:

You can delete the preceeding “th” styles. The “th” tag centers its contents by default.

In HTML, assign the colspan attribute to the “th” tag:


<th colspan="3">

Good catch, there, Ron.
I’m surprised I didn’t find that on other forums when searching for this information.

You were probably looking for a CSS solution. There is no CSS equivalent to the colspan attribute. “Just one of those crazy things…”