DIV Sections Overlapping One Another

SavageSpud

I have made a sidebar which is positioned as fixed to the left-hand side of the screen. Then where the issue comes in is the 'first' section of context is fine just when I try to add the second section of context, it basically sits its exactly on top of the first section instead of going under it. I have tried different positioning but it's always either on top of it or to the left of the screen ignoring the sidebar. So my question is, how do I get the second section to continue under the first section and the third section then of course to follow on the same way. Thanks in advance.

body{

    background-color: #fdfdfd;
    font-family: Arial, "Open Sans", sans-serif-light, sans-serif, "Segoe UI";
}

#wrapper {
    width: 100%;
    height: 100%;
}

#sidebar{
    background-color: #212528;
    position: fixed;
    width: 20%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
}

#nav{
    color: #DADADA;
    display: block;
    max-width: 100%;
}

#nav ul {
    padding-left: 0;
}

#nav li{
    list-style-type: none;
    margin: 0;
    padding: 0.75em 0 0.75em 0;
    text-align: center;
    max-width: 100%;
}

#nav li:hover {
    background:#333;
}

#nav li a {
    display: block;
    padding: 0.5em 0;
}

.link{
    text-align: right;
    margin-right: 25%;
    letter-spacing: 1px;
}

#welcometext{
    text-align: center;
    font-style: italic;
    text-transform: uppercase;
    font-size: 1em;
    margin-top: 2em;
}

#searchbar{
    width: 70%;
    margin-left: auto;
    margin-right: auto;
    padding: 1em 1em 0.5em 1em;
    text-align: right;
}

#searchbar input{
    max-width: 95%;

}

#sectionone {
    position: fixed;
    top: 0;
    right: 0;
    width: 80%;
}

#containerone {
    margin-top: 0;
    width: 80%;
    height: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    border-bottom: 2px solid #DADADA;
    box-shadow: inset 0 -6px 0 0 #fdfdfd, inset 0 -8px 0 0 #DADADA;
}

#header{
    margin: 6em 0 6em 0;
}

#logo h1 {
    color: #ed786a;
    text-shadow: 0.1em 0.1em 0 rgba(0,0,0,0.1);
    letter-spacing: 13px;
}

#logo p {
    margin-top: -0.6em;
    color: #888888;
    letter-spacing: 4px;
    font-size: 0.85em;
}

#sectiontwo{
    float: ;
    width: 80%;
    top: 0;
    right: 0;
}

#containertwo{

    width: 80%;
    height: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title>Lakeside Books</title>
    <link rel="stylesheet" type="text/css" href="masterstyle.css">
    <meta name="viewsize" content="width-device-width,initial-scale=1.0">

    <!--[if IE]>
    <script type="text/javascript" src="_http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

</head>

<body>
<div id="wrapper">
    <div id="sidebar">
        <nav id="nav">
            <h3 id="welcometext">Welcome To<br>Lakeside Books</h3>
            <div id="searchbar">
                <form action="http://www.example.com/search.php">
                    <input type="text" name="search" placeholder="...Search Book Title"/>
                </form>
            </div>
            <ul>
                <li>
                    <a class="link">
                        Home
                    </a>
                </li>
                <li>
                    <a class="link">
                        Categories
                    </a>
                </li>
                <li>
                    <a class="link">
                        Bestsellers
                    </a>
                </li>
                <li>
                    <a class="link">
                        Contact
                    </a>
                </li>
            </ul>
        </nav>
    </div>

    <div id="sectionone">
        <div id="containerone">
            <div id="header">
                <div id="logo">
                    <h1>LAKESIDE BOOKS</h1>
                    <p>KERRYS LOCAL BOOKSTORE</p>
                </div>
            </div>
        </div>
    </div>

    <div id="sectiontwo">
        <div id="containertwo">
            <h2>Best Selling Books Right Now</h2>
        </div>
    </div>

</div>
</body>
</html>

Image of the problem - http://i.imgur.com/g9ur5eS.png

Jamie Barker

Based upon the answer to my comment, you don't want sectionone to have position:fixed;. I have put /* ### */ next to CSS I have added, and commented out anything that needs removing.

Basically I've added some resetting rules to html/body and then added a 20% left margin to the wrapper. The other elements just flow next to it naturally.

html, body { /* ### */
    margin:0;
    padding:0;
    height:100%;
    width:100%;
}
body {
    background-color: #fdfdfd;
    font-family: Arial, "Open Sans", sans-serif-light, sans-serif, "Segoe UI";
}
#wrapper {
    width: 100%;
    height: 100%;
    margin:0 0 0 20%; /* ### */
}
#sidebar {
    background-color: #212528;
    position: fixed;
    width: 20%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
}
#nav {
    color: #DADADA;
    display: block;
    max-width: 100%;
}
#nav ul {
    padding-left: 0;
}
#nav li {
    list-style-type: none;
    margin: 0;
    padding: 0.75em 0 0.75em 0;
    text-align: center;
    max-width: 100%;
}
#nav li:hover {
    background:#333;
}
#nav li a {
    display: block;
    padding: 0.5em 0;
}
.link {
    text-align: right;
    margin-right: 25%;
    letter-spacing: 1px;
}
#welcometext {
    text-align: center;
    font-style: italic;
    text-transform: uppercase;
    font-size: 1em;
    margin-top: 2em;
}
#searchbar {
    width: 70%;
    margin-left: auto;
    margin-right: auto;
    padding: 1em 1em 0.5em 1em;
    text-align: right;
}
#searchbar input {
    max-width: 95%;
}
#sectionone {
    /*position: fixed;*/
    top: 0;
    right: 0;
    width: 80%;
}
#containerone {
    margin-top: 0;
    width: 80%;
    height: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    border-bottom: 2px solid #DADADA;
    box-shadow: inset 0 -6px 0 0 #fdfdfd, inset 0 -8px 0 0 #DADADA;
}
#header {
    margin: 6em 0 6em 0;
}
#logo h1 {
    color: #ed786a;
    text-shadow: 0.1em 0.1em 0 rgba(0, 0, 0, 0.1);
    letter-spacing: 13px;
}
#logo p {
    margin-top: -0.6em;
    color: #888888;
    letter-spacing: 4px;
    font-size: 0.85em;
}
#sectiontwo {
    float:;
    width: 80%;
    top: 0;
    right: 0;
}
#containertwo {
    width: 80%;
    height: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
<div id="wrapper">
    <div id="sidebar">
        <nav id="nav">
             <h3 id="welcometext">Welcome To<br />Lakeside Books</h3>

            <div id="searchbar">
                <form action="http://www.example.com/search.php">
                    <input type="text" name="search" placeholder="...Search Book Title" />
                </form>
            </div>
            <ul>
                <li> <a class="link">
                        Home
                    </a>

                </li>
                <li> <a class="link">
                        Categories
                    </a>

                </li>
                <li> <a class="link">
                        Bestsellers
                    </a>

                </li>
                <li> <a class="link">
                        Contact
                    </a>

                </li>
            </ul>
        </nav>
    </div>
    <div id="sectionone">
        <div id="containerone">
            <div id="header">
                <div id="logo">
                     <h1>LAKESIDE BOOKS</h1>

                    <p>KERRYS LOCAL BOOKSTORE</p>
                </div>
            </div>
        </div>
    </div>
    <div id="sectiontwo">
        <div id="containertwo">
             <h2>Best Selling Books Right Now</h2>

        </div>
    </div>
</div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

One div is overlapping another when using polymer

From Dev

One div is overlapping another when using polymer

From Dev

Div overlapping another div

From Dev

Div overlapping another div -Bootstrap

From Dev

Right sidebars overlapping one another

From Dev

Fixed image overlapping another div

From Dev

Stop background color of one div covering the content of another, rotated and thus overlapping, div

From Dev

border radius of a div inside another div is overlapping

From Dev

Div Overlapping another Div when reduced

From Dev

Div overlapping another div while scrolling

From Dev

Splitting one Div into two css sections?

From Dev

UICollectionView Sections Overlapping

From Dev

Why are these "sections"/ "boards" overlapping

From Dev

Bootstrap overlapping sections

From Dev

How to avoid a div overlapping another fixed div in Bootstrap?

From Dev

Two gradients with two distinct sections with just one div element

From Dev

Add column from one dataframe to another, for values present in overlapping column

From Dev

Filling background using CSS - two different colors and one overlapping another

From Dev

replace one div with another on hover

From Dev

Replace one div with another - jquery

From Dev

Put one div after another

From Dev

Toggle one <div> and close another?

From Dev

Position div beside another one

From Dev

One div block above another

From Dev

jquery one div replacing another

From Dev

Align one div to the bottom of another

From Dev

How do I can change contents of some div sections while clicking text from another div

From Dev

Place one div with price above another one

From Dev

How to show one div over another one?

Related Related

HotTag

Archive