我有幾個div,其中一個覆蓋另外兩個。因此,對於底部的div我用這樣的事情(CSS):如何減少頁面的底部溢出CSS/HTML
position:relative;
top:-200px;
但現在我有剩餘的上是空的頁面底部200個像素。我如何切斷/清除溢出? 完整的CSS代碼:
div.headertop
{
background-image:url('images/bkb.png');
background-repeat:repeat;
width: 1000px;
height:200px;
background-color: black;
color:white;
display: block;
margin-left: auto;
margin-right: auto;
}
div.headerbottom
{
background-image:url('images/bkg.png');
background-repeat:repeat;
background-position:bottom;
width: 1000px;
height:125px;
position:relative;
margin-left: auto;
margin-right: auto;
}
div.headerlogo
{
background-image:url('images/bkw.png');
background-repeat:repeat;
width: 800px;
height:200px;
position:relative;
top:-200px;
margin-left: auto;
margin-right: auto;
}
div.content
{
background-image:url('images/bkg.png');
background-repeat:repeat;
background-position:top;
width: 1000px;
min-height:500px;
position:relative;
top:-200px;
margin-left: auto;
margin-right: auto;
}
div.footer
{
background-image:url('images/bkb.png');
background-repeat:repeat;
width: 1000px;
height:100px;
line-height:100px;
background-color: black;
position:relative;
top:-200px;
color:white;
display: block;
margin-left: auto;
margin-right: auto;
color: white;
text-align: center;
}
HTML正文代碼:
<body>
<div id="back">
<div class="headertop">
Hello!
</div>
<div class="headerbottom">
</div>
<div class="headerlogo">
<a href="index.html"><img border="0" src="images/logo.png" alt="Future Me - Home"/></a>
</div>
<div class="content">
Lorem ipsum dolor sit amet, consectetur adipiscing...
</div>
<div class="footer">
</div>
</div>
</body>
如果您發佈了示例工作代碼,那將會很棒。 html和css – Sowmya
固定身體的高度 –
@Pwn固定身體的高度會阻止頁面調整到頁面內容的正確高度,可能會太早切斷! – drmonkeyninja