achalk Posted September 2, 2012 Share Posted September 2, 2012 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 More sharing options...
niche Posted September 2, 2012 Share Posted September 2, 2012 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 More sharing options...
dsonesuk Posted September 2, 2012 Share Posted September 2, 2012 ??? You mean vertical-align:middle; Link to comment Share on other sites More sharing options...
achalk Posted September 2, 2012 Author Share Posted September 2, 2012 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 More sharing options...
dsonesuk Posted September 2, 2012 Share Posted September 2, 2012 That does not makes sense? text-align: center; should be all you need to centre the text horizontally. post ALL table code, and related css styling. Link to comment Share on other sites More sharing options...
achalk Posted September 2, 2012 Author Share Posted September 2, 2012 dsonesuk: You are right. When I run it in the browser (Chrome 21.0.1180.89) it does work. It was failing in VS2010 "design view". I suppose the moral is: Always test in the browser. Thks for your help! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.