当我给它一个负余量时,为什么我的div在另一个元素下面

时间:2013-03-26 20:29:50

标签: html css

所以我有一个div (.section-page-layout),余量为(margin-top:-200px),而div (.section-page-layout)位于div (.section-page-header)下面,它应该越过它。我将代码上传到了一个演示链接,您可以使用Firebug或其他方式进行操作。我还包括了我的代码。

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

提前致谢!

CSS代码

/* 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>

1 个答案:

答案 0 :(得分:1)

如果父元素上有overflow:hidden,那么当您将子元素移出父元素时,它将被隐藏。