Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text-align

Status
Not open for further replies.

iminore

Programmer
Sep 3, 2002
50
GB
Can anybody suggest why the following doesn't work:

<html<head></head><body>
<table width=&quot;100%&quot;><tr><td width=&quot;100%&quot;>
<span style=&quot;text-align:left;&quot;>aaa</span>
<span style=&quot;text-align:right;&quot;>bbb</span>
</td></tr></table>
</body></html>

that is, why isn't 'bbb' over to the right?
 
Try this script:

[tt]
<html<head></head><body>
<table width=&quot;100%&quot;><tr><td width=&quot;100%&quot;>
<p align=&quot;left&quot;>aaa</p>
<p align=&quot;right&quot;>bbb</p>
</td></tr></table>
</body></html>
[/tt]
 
The problem was that although the <td> was set to 100% of the width, the <span> were set only to the width of the text inside of it. The alternatives are using a <p>, like in the example above, or setting the widths of the <spans> to 100%. Second way below:

<html>
<head></head>
<body>
<table width=&quot;100%&quot;>
<tr>
<td width=&quot;100%&quot;>
<span style=&quot;width:100%;text-align:left;&quot;>aaa</span>
<span style=&quot;width:100%;text-align:right;&quot;>bbb</span>
</td>
</tr>
</table>
</body>
</html>

Rick -----------------------------------------------------------
 
Actually, on looking at your question closer, I think this is the effect that you want:

<html>
<head></head>
<body>
<table width=&quot;100%&quot;>
<tr>
<td width=&quot;100%&quot;>
<span style=&quot;width:50%;text-align:left;&quot;>aaa</span>
<span style=&quot;width:50%;text-align:right;&quot;>bbb</span>
</td>
</tr>
</table>
</body>
</html>

Rick -----------------------------------------------------------
 
Or use float:left; and float:right; to position the spans left and right.

Better yet why not nest another table there?


É
::
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top