1 reply [Last post]
Last seen: 17 years 40 weeks ago
Joined: 2004-04-22
Posts: 1
Points: 0

I read this post http://www.csscreator.com/css-forum/ftopic2828.html with great interest. The original question was, how to achieve the following using CSS

<table width="600" bgcolor="red"> 
         <td align='left' width="300">Some text</td> 
         <td align='right'>Some other text</td> 

Excavator suggested a solution using the float and text-align property, and it works fine. However what if I want to right align the left cell and left align the right cell? I know it sounds weird, but forms looking like this is every where, for example, https://www.macys.com/myinfo/register/index.ognc

What I tried doing was

#container { 
#left { 
   float: left; 
   text-align: right; 
#right { 
   float: right; 

and the actual HTML code is
<div id="container"> 
<div id="left">Form field name</div> 
<div id="right">Form field</div> 

But the result page still has the left cell text aligned left and right cell input fields aligned right, and there is so much space between the text and input fields, and it just doesn't look right.

If anybody knows the answer, please let me know. I have googled for an hour for answers, but no luck.



ClevaTreva's picture
A hilly place, UK
Last seen: 3 years 12 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

Another question on the different alignment on the same row


Did you try putting another div inside the floated div's and setting the text-alignment there?