I am trying to place a second identical sidebar on my page for adsense.
Here is the CSS:
#page {
width: 940px;
margin: 0px auto;
padding: 5px;
position: relative;
top: 20px;
background-color:#F3EFA3;
border: 3px groove #00BFFF;
}
#sidebar {
background: #C0DCC0;
width: 120px;
border: 2px solid #2A0000;
position: absolute;
height: 600px;
top: 200px;
right: 2%;
float: right;
}
#sidebar2 {
background: #C0DCC0;
width: 120px;
border: 2px solid #2A0000;
position: absolute;
height: 600px;
top: 200px;
left: 2%;
float: left;
}
#footer {
width: 70%;
font-family: Arial, Helvetica, sans-serif;
color:#D47F00;
position: relative;
bottom: 30px;
text-align:center;
z-index: 1;
left: 15%;
height: 30px;
vertical-align:text-bottom;
line-height: 30px;
margin-bottom: 30px;
margin-top: 50px;
top: 95%;
}
This is two divs either side of the central column #page and above #footer. #sidebar is great.
I thought this would also work for the left hand div #sidebar2, but it sits nearly all the way below #page and pushes the footer all the way down.
Help would be great.
I am hopeful for a resolution to this with you guys having a 100% success rate with me so far.
Cheers.
Message was edited by: hobittual PS I just found out this works perfectly as a local file in my browser, but not when I upload it to the server?
You cannot float absolutely positioned elements. It's one or the other.
Try this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
width: 940px;
margin: 0px auto;
padding: 5px;
background-color:#F3EFA3;
border: 3px groove #00BFFF;
font-family: Arial, Helvetica, sans-serif;
}
#sidebar1 {
background: #C0DCC0;
width: 18%;
border: 2px solid #2A0000;
float: left;
min-height: 600px;
}
#mainContent {
float: left;
width: 60%;
margin-left: 1%;
margin-right: 1%;
min-height: 600px;
}
#sidebar2 {
background: #C0DCC0;
width: 18%;
border: 2px solid #2A0000;
float: right;
min-height: 600px;
}
#footer {
clear:both;
color:#D47F00;
text-align:center;
}
</style>
</head>
<body>
<div id="sidebar1">
Sidebar1
</div>
<div id="mainContent">
MainContent
</div>
<div id="sidebar2">
Sidebar2
</div>
<div id="footer">
Footer
</div>
</body>
</html>
Nancy O.
Thanks Nancy, I have no doubt that your answer is 100% accurate, but in terms of my abilities and progress thus far, to apply your instructions to my predicament directly, would become fiendishly complicated and my tenuous comprehension of web developement would be dashed on the rocks of unfathomable chaos.
With this in mind, I will endeavour to start over with your skeletal structure as the basis for a rebuild, if you don't mind
My thanks, over.
North America
Europe, Middle East and Africa
Asia Pacific