Thread: Align text to Centered table
Results 1 to 7 of 7
Related
-
How do I align Text in the same line? Forum: HTML Forum
Replies: 10 -
IE 6 text-align center problem Forum: HTML Forum
Replies: 5 -
Align text with an image link? Forum: HTML Forum
Replies: 2 -
text-align center problem - only in ie6 Forum: CSS Forum
Replies: 4
-
12-26-2003, 02:50 PM #1
Align text to Centered table
I have some text that is written above a table. I want the table centered on the page and the text above the table, left justified to the table. In other words, I don't want the text left-justified on the page...I want it left-justified to the table below it. I looked at centering a table that contains the text and the original table, but I still can't get the text to left justify...it always shows up centered. Any ideas??? Any small examples of how to do this? Thanks in advance!!
-
12-26-2003, 04:43 PM #2bald headed old fart
Status- Offline
Join Date- Aug 2003
Location- chertsey, a small town 25 miles south west of london, england.
Posts- 739
Hi there J-Man.
Do you mean like this...Code:<html> <head> <style type="text/css"> <!-- div { position:absolute; left:50%; margin-left:-200px; //-- this is half the table width } td#one { border:solid 1px #000000; width:400px; height:300px; text-align:center; } //--> </style> </head> <body> <div> <table><tr> <td>Text on the left</td> </tr><tr> <td id="one">Table cell</td> </tr></table> </div> </body> </html>
thead
-
12-26-2003, 04:53 PM #3
coothead,
That is what I'm looking for. However, I don't know the table width and I'd like to do this without CSS. Any other ideas?
Thanks again!!!
-
12-26-2003, 06:08 PM #4bald headed old fart
Status- Offline
Join Date- Aug 2003
Location- chertsey, a small town 25 miles south west of london, england.
Posts- 739
Hi there J-Man,
well, of course, if you do not mind using deprecated code
just use this.... and add whatever attributes you require
<center>
<table><tr>
<td>Text on the left</td>
</tr><tr>
<td align="center">Table cell</td>
</tr></table>
</center>
cthead
-
12-29-2003, 08:50 PM #5
Originally Posted by coothead
Code:<center> <table><tr> <td>Text on the left</td> </tr><tr> <table><tr> <td align="center">Table cell</td> </tr></table> </tr></table> </center>
-
12-30-2003, 03:28 PM #6
After much trial and error, I've come up with the solution:
Code:<center> <table><tr> <td>Text on the left</td> </tr><tr> <td> <table><tr> <td>Table cell</td> </tr></table> </td> </tr></table> </center>
Notice the placement of the <td> and </td> around the inner table!!!
-
12-30-2003, 06:03 PM #7
Content must always be placed within td tags, this includes nested tables. Your previous code <tr><table> is a no-no
Dave