CSS Footer之后的微小空间

时间:2015-02-07 16:37:32

标签: css footer

我在删除页脚后的空白区域时遇到问题。我能够在chrome设置中删除它 - margin-bottom但是这对Firefox或IE不起作用。我不太清楚我理解为什么白色空间就在那里。

感谢任何帮助。

<div class="footer">
  <section class="footer-inner">
    <p class="footer-text">Copyright</p>
  </section>
</div>

.footer {
  height: 300px;
}
.footer-inner {
  margin-top: -10px;
  background-color: #E0E6E6;
}
.footer-text {
  padding: 100px 0;
  text-align: center;
}

http://jsfiddle.net/trws2062/http://www.johndayers.com/versions/v9/footer_branch/

2 个答案:

答案 0 :(得分:1)

您的页脚当前是一个p类,它在页脚上创建了一个下边距:

p {
    margin: 0 0 10px;
}

将页脚从段落更改为div,如下所示:

<div class="footer-text">
    Copyright &copy; 2015 etc...
</div>

答案 1 :(得分:0)

因为bootstrap会在p元素中添加margin, 在.footer-text中设置margin-bottom应该可以正常工作

.footer-text {
  padding: 100px 0;
  text-align: center;
  margin-bottom: 0;
}