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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

To arrange two columns beside each other without tables? 2

Status
Not open for further replies.

hotfusion

Technical User
Jan 20, 2001
755
GB
Please forgive my lack of knowledge about CSS, but I'm trying to position two separate columns of text of differing widths side by side on a page using CSS rather than tables, and can't find the information I need to do it. I've tried specifying margin-left and right for either <div>s or <p>s, along with a few other options I'm aware of but the results are the same: The first column always appears above the other rather than beside it.

Could anyone please give me a clue as to how it should be correctly done?
Many thanks in advance.

Regards, Andy.
**************************************
My pathetic attempts at learning HTML can be laughed at here:
 
Code:
#leftcol {
    [red]float: left;[/red]
    width: 100px;
    }

#rightcol {
    [red]float: right;[/red]
    width: 100px;
    }

#all {
    width: 200px;
    text-align: center;
    margin: 0 auto;
}
Code:
<div id="all">
 <div id="leftcol">
  This stuff should show up on the left
 </div>
 <div id="rightcol">
  this stuff should show up on the right
 </div>
</div>
Something like that?

--Chessbot
 
Thanks to both of you for your input. I'm used to using the float property for images in spans only, and had completely overlooked the fact that it can be used for other elements as well. Chessbot, you code was very helpful, as was the link supplied by Philote.

Looks like I might now have cracked the problem and am no longer at risk of pulling out any more of my hair!
Cheers guys.

Regards, Andy.
**************************************
My pathetic attempts at learning HTML can be laughed at here:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top