gpt4 book ai didi

html - 当我给它一个负边距时,为什么我的 div 会在另一个元素下面

转载 作者:太空宇宙 更新时间:2023-11-04 15:08:20 24 4
gpt4 key购买 nike

所以我有一个 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代码

<!-- ===============
=== 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>

最佳答案

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

关于html - 当我给它一个负边距时,为什么我的 div 会在另一个元素下面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15646772/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com