Jump to content

Centering text in a td element relative to the colspan


achalk

Recommended Posts

I have a table. Assume that it has five columns. I have specified one row as having a colspan of 5 columns. I want to center text in that column. The text-align:center attribute of the <td> tag centers the text, but relative to the first column, not the full colspan. Anyone know how to do this? Many thanks.

Link to comment
Share on other sites

If this table is meant to create the structure for your page, use div and float. If not, please post the relevant code you've created, so far, using the code tags.

Link to comment
Share on other sites

dsonesuk: No.I want the text aligned in the middle of the left and right boundaries of the five columns spanned by the <td> tag. Here is the exact code that I have (this is the code that does not work). Text alignment attribute bolded for emphasis: <tr><td class="style2" colspan="5" nowrap="nowrap" style="color:red;text-align:center" >value for current day</td></tr> Replacing the alignment attribute with "vertical-align:middle" does not work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...