CSS newboy questions

Associate
Joined
27 Jun 2006
Posts
1,473
Evening!

I am trying to do a site using CSS but cannot get my head round how to get 2 different <div> elements side by side.

Here is the CSS:

Code:
body
{
	text-align: center;
}

#frame
{
	width:800px;
	margin-right:auto;
	margin-left:auto;
	padding:2px 2px 2px 2px;
	text-align:left;
	background:#eee;
	border: solid 1px #cccccc;
}

#logo
{
	height:100px;
	padding:2px 0px 0px 2px;
	text-align:left;
	background:#c5c5c5;	
}

#nav
{
	height:20px;
	padding:2px 2px 2px 2px;
	text-align:left;
	background:#3399ff;
}

#content
{
	text-align:left;
	padding:2px 2px 2px 2px;
	background:#ccccaa;
}

#footer
{
	padding:2px 2px 2px 2px;
	background:#c4c4c4;
}

#contentleft
{
	width: 120px;
	height: 100%;
	background: #ff0000;
	float:left;
}

#contentright
{
}

What I am after is a left hand column (the red one) to hold text in a small strip down the left and the right hand side of that is where the content goes.

What you can see here makes my eyes bleed being a new boy.

I want all the text to the right of the red box to stay to the right and not wrap under the box.

In fact what I really want is for that red box to stretch down to the footer bar at the bottom, even if there is not enough text to fill it - as well as all text to the right staying to the right!

I find it hard to describe this kind of stuff so apologies for the ramble.

Any hints or tips appreciated!

M.

edit: apologies for the colours on the page, they are for me to see what goes where :)
 
Give #contentright the

Code:
float: right;

attribute. You will also need to set a width on #contentright and I *think* the

Code:
height: 100%;

attribute should bring the red box all the way down :)
 
Ah I forgot the margin to keep the content to the right of the red box, but still can't make that red box go down to the bottom!

Cheers
M.
 
Ahh, for height: 100% to work, you need a height set on the parent div so I don't know whether it will work for your situation particularly well :(
 
Back
Top Bottom