kevingilbert100
kevingilbert100

Reputation: 1333

Why Is my div going under another element when I give It a negative margin

So I have a div (.section-page-layout) with a margin of (margin-top:-200px) and the div (.section-page-layout) is going under the div (.section-page-header) where it should be going over it. I uploaded the code to a demo link where you can fiew it with Firebug or whatnot. I have also included my code.

http://kmgp.us/stackoverflow/section_page_template.html

Thanks in advance!

CSS CODE

/* Header */
.section-page-header {
    background: url("../img/frontcover.jpg") no-repeat;
    background-size: cover;
    width: auto;
    height: auto;
    min-height: 727px;
    min-width: 1280px;
}
.section-page-header-title_container {
    width: 1280px;
    position: relative;
    margin: 0 auto;
}
.section-page-header-title {
    margin-top: 83px;
    border-top: 7px #5b461c solid;
    width: 1170px;
    float: left;
    height: 167px;
    background: #000000;
    -webkit-border-radius: 0px 0px 50px 0px;
    border-radius: 0px 0px 50px 0px;
    /* IE 8 */
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
    /* IE 5-7 */
    filter: alpha(opacity=90);
    /* Gecko */
    -moz-opacity: 0.9;
    /* Safari 1.x */
    -khtml-opacity: 0.9;
    /* CSS3 */
    opacity: 0.9;
}
.section-page-header-title h1 {
    font-family: 'QuicksandBook';
    margin-left: 147px;
    margin-top: 46px;
    font-size: 50px;
    color: #FFFFFF;
    text-transform: uppercase;
}
.section-page-header-title p {
    margin-top: 12px;
    margin-left: 147px;
    font-family: 'junctionregularRegular';
    color: #ff9900;
    text-transform: uppercase;
}
.section-page-layout-container {
    background:#984B09;
    background: url('../img/section-page-oj_gradient-background.png') repeat-y;
    background-size:contain;
    width: 100%;
    overflow: hidden;
}
.section-page-layout {
    width: 1280px;
    position: relative;
    margin: 0 auto;
    height: auto;
    overflow: visible;
    margin-top:-200px;
}
.left-section-container {
    width: 585px;
    height: 500px;
    background: #FFFFFF;
    float: left;
}

HTML CODE

<!-- ===============
=== Section Page Template
=============== -->
<header class="section-page-header">
    <div class="section-page-header-title_container">
        <div class="section-page-header-title">
            <h1>ABOUT <b>US</b></h1>
            <p>A simple glance into our company</p>
        </div>
    </div>
</header>
<section class="section-page-layout-container">
    <div class="section-page-layout">
        <div class="left-section-container">
            <header> </header>
            <div class="left-section">
            </div>
        </div>
        <div class="right-module-section">

        </div>
    </div>
</section>
<div class="clear"><!-- Clear --></div>

Upvotes: 2

Views: 3891

Answers (1)

MiniRagnarok
MiniRagnarok

Reputation: 959

If you have overflow:hidden on a parent element then when you move the child outside of the parent it will be hidden.

Upvotes: 3

Related Questions