这不会发生在 chrome 或 ie 中。 Firefox 在我的页脚后添加了 50px。使用 analyze element 和 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; }
最佳答案
一些事情:
- 不应该有
<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;}
关于html - firefox 在页脚标签后添加空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12661901/