这不是在chrome或ie中发生的。 Firefox改为在我的页脚后添加50px。使用analyze元素和firebug,它显示该空间在html标记之外。这是链接:http://www.sociallab.ro/index_romana 谢谢!
HTML:
<html>
<body>
<div id="main">
</div>
<footer>
<a href="http://www.messagelab.ro" target="_blank"><div class="message_lab"><img src="images/logo_mic.png" alt="Tineret in Actiune"/></div></a>
</footer>
</body>
</html>
的CSS:
html{
margin: 0;
padding: 0;
}
footer{position:relative;
top: -50px;
width:1060px;
height:50px;
overflow:hidden;
text-align: center;
margin:0 auto;
padding:0;}
body{
margin-top:0px;
margin:0 auto;
padding:0;
text-align: center;
height: 1950px !important;
background:url(../images/bg.png) left top repeat; }
答案 0 :(得分:3)
<div>
标记内不应有<a>
标记。height
和body
有一个#wrap
。footer
,请移除top: -50px;
并将其替换为margin
为负margin-top: -50px;
。不使用div,请使用以下方式:
<footer>
<a target="_blank" href="http://www.messagelab.ro">
<img alt="Tineret in Actiune" src="images/logo_mic.png">
</a>
</footer>
和CSS:
footer a {display: block; text-align: center;}
答案 1 :(得分:2)
而不是使用top:-50px,在页脚上使用margin-top:-50 px,问题就解决了。