Jump to content

Centering text in a td element relative to the colspan


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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...