dwella
23 Feb 2010, 02:45 PM
Hi Im back doing some web design after a long hiatus.. I admit Ive forgot ALOT so please bare with me.
this is my problem:
Ive built a website and I want to align two divs next to each other. I managed to do that with float left and right. However, the footer gets pushed away somewhere and the background image for the content div (in which I have the 2 divs) disappears and so does the background image of the footer. Ive searched the web, watched tutorials on how to align two divs next to each other. people say you need to have a clear: both; etc, Ive tried it but it doesnt work.
If I put a clear: both; in the footer, the footer is fine, but the background image of the content div still disappears!
have a look here at how it looks:
www.marcuslew.com/Cru/index.html
right now my code looks like this:
#content {
background-image:url(../images/bg.jpg);
background-repeat:repeat-y;
width: 795px;
}
#leftContent {
width: 600px;
float: left;
background-color: green;
margin: 0px 0px 0px 7px;
}
#rightContent {
width: 181px;
float: right;
background-color: red;
margin: 0px 7px 0px 0px;
}
#footer {
background-image:url(../images/footer.jpg);
background-repeat:no-repeat;
height: 46px;
width: 795px;
border: none;
padding: 0px;
margin: -5px 0px 0px 0px;
clear: both;
}
Can someone please point out to me what im doing wrong here and how to correct it and how I can have my layout as I want it?
Thanks alot!
this is my problem:
Ive built a website and I want to align two divs next to each other. I managed to do that with float left and right. However, the footer gets pushed away somewhere and the background image for the content div (in which I have the 2 divs) disappears and so does the background image of the footer. Ive searched the web, watched tutorials on how to align two divs next to each other. people say you need to have a clear: both; etc, Ive tried it but it doesnt work.
If I put a clear: both; in the footer, the footer is fine, but the background image of the content div still disappears!
have a look here at how it looks:
www.marcuslew.com/Cru/index.html
right now my code looks like this:
#content {
background-image:url(../images/bg.jpg);
background-repeat:repeat-y;
width: 795px;
}
#leftContent {
width: 600px;
float: left;
background-color: green;
margin: 0px 0px 0px 7px;
}
#rightContent {
width: 181px;
float: right;
background-color: red;
margin: 0px 7px 0px 0px;
}
#footer {
background-image:url(../images/footer.jpg);
background-repeat:no-repeat;
height: 46px;
width: 795px;
border: none;
padding: 0px;
margin: -5px 0px 0px 0px;
clear: both;
}
Can someone please point out to me what im doing wrong here and how to correct it and how I can have my layout as I want it?
Thanks alot!