Search code examples
htmlcsspositioningcontainers

content overlapping sidebar


I have content that is overlapping the sidebar. If you look at the margin and padding for the sidebar container, you'll see that I had to I've tried numerous things including adjusting the position, but nothing works-

***EXAMPLE SCREENSHOT: http://tinyurl.com/cefamyt

***WORKING EXAMPLE http://www.bestthrillermovielist.com/indextest.php#topofpage

ALSO when I set the sidebar container to a set height, say, 4000px; instead of the way I currently have it, none of the movie content overlaps into the sidebar. I've tried to get the sidebar container to stretch the full height of the window to no avail

The content from #movieinfo is overlapping the content from the sidebar ONCE the sidebar content ends. The margin/padding on the #sidebarcontainer allow the sidebar to extend to the complete length of the screen, but for some reason, the #movieinfo content slides to the right underneath where the sidebar content ends.

CSS:

#container {
    max-width:90%;
    margin-left:auto;
    margin-right:auto;
    margin-top:25px;
    overflow:hidden;
}

#movieinfo {
    padding-right:375px;
    margin-top:25px; 
    display:inline;
    position:relative;
}

#sidebarcontainer {
    float: right; 
    width:345px;
    background:#fff;
    margin-bottom: -5000px; 
    padding-bottom: 5000px; 
    height:100%;
    position:relative;
}

#movieright {
    float:right; 
    width:340px;
    height:100%; 


    }

#movierightcontainer {
    float:right;
    width:100%;
    margin-bottom:8px;
    margin-top:0px;
    height:100%;
    padding: 0 2%;

}

.movienav {
    width: 320px;
    height: 430px;
    float: left;
    margin-right: 20px;
    position: relative;
    display:inline;
    margin-top:25px;
    margin-bottom:45px;
}

HTML

<div id="container">
    <div id="movieinfo"> 
        <?php include("sidebar.php");?>
 <div class="movienav"></div>
    </div>
</div>

***SIDEBAR.php***
<div id="sidebarcontainer">
    <div id="movierightcontainer">
        <div id="movieright"></div>
     </div>
</div>

Any help is appreciated.


Solution

  • The problem is you are putting everything in #container There needs to be a separate div for the left column than the right column. The movie posters are overlapping the right column because the right column is floated right and there isn't anymore content. Which is why adding height to the right column worked.

    I've created a simplified version of what needs to happen in a jsfiddle. I made the posters smaller, so it is easier to view in their preview window. But the concept is correct.

    Here is the jsfiddle link.