Skip navigation
Currently Being Moderated

Can't place second sidebar?????

Aug 4, 2012 10:35 AM

Tags: #div #sidebar #prophylactic #lycanthrope

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?

 
Replies
  • Currently Being Moderated
    Aug 4, 2012 10:52 AM   in reply to hobittual

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 4, 2012 11:50 AM   in reply to hobittual

    No prob. Rebuild away.  

     

     

    Nancy O.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points