页面底部的额外空间

问题描述:

出于某种原因,我的页面底部有很多额外的空白区域,我似乎无法摆脱。我不能在空间内放置任何东西,也不能摆脱它。我做了一些研究,我有一个预感,它与我的图像是position:relative这一事实有关,但我仍然不完全确定。如果我需要摆脱position:relative,有人请告诉我如何放置不使用position:absoluteposition:relative的图像吗?页面底部的额外空间

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<link rel="stylesheet" type="text/css" href="SDL.css"> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<title>Home</title> 
</head> 

<body> 
<center> 
<img src="img/SDL 4 Final Recompress.jpg" height="283" style="position: relative;"/> 
<br/> 
<hr width="500"/> 


<img src="img/Studio-Light_sxu1.png"   style="position: relative; top: -496px; left: 30px; z-index: 3; height: 200px;"/> 
<img src="img/Studio-Light_sxu1 flipped.png" style="position: relative; top: -496px; left: 650px; z-index: 3; height: 200px;"/> 

<embed 
src="http://blip.tv/play/AwGUv2w" 
type="application/x-shockwave-flash" width="669" 
height="500" allowscriptaccess="always" 
allowfullscreen="true" wmode="transparent" style="position:relative; z-index: 2; top:100px; left:-200px"> 
</embed> 

<img src="img/Stage-Background.png" style="position: relative; z-index: 1; height: 680px; top:-500px"/> 
</center> 

<div id="nav"> 
<p>All Episodes</p> 
<a>Contact</a> 
<a>Facebook</a> 
<a>Meet the Crew</a> 
</div> 





</body> 
</html> 
+0

它适用于我,没有额外的空白。你可以把你的代码放在http://jsfiddle.net/? – AliBZ 2013-05-02 00:01:02

更改此

<img src="img/Stage-Background.png" style="position: relative; z-index: 1; height: 680px; top:-500px"/> 

<img src="img/Stage-Background.png" style="z-index: 1; height: 680px; margin-top:-500px"/> 

当你这样做的位置是:相对的,移动它,它会保留文档的其余部分一样,如果你没有动它,所以它具有保持空间在它下面。如果你做一个负边界顶部,它会拉动图像向下移动的所有东西。

+0

这解决了它。你介意告诉我为什么这有效吗? – qaxf6auux 2013-05-02 00:21:24

+0

添加解释到答案 – dave 2013-05-02 00:26:43

+0

真棒。另外,如果你摆脱了“position:relative”,为什么z-index仍然适用? – qaxf6auux 2013-05-02 00:32:49

它看起来像

<img src="img/Stage-Background.png" style="position: relative; z-index: 1; height: 680px; top:-500px"/>

导致您的问题,尝试改变

height: 680px;

看问题是否存在

+0

改变高度摆脱了空间,但它也缩小了图像。还有另一种方法可以改变它吗? – qaxf6auux 2013-05-02 00:16:10