如何将版权页脚放置在页脚的中心底部?

时间:2015-12-11 16:52:09

标签: html css

如何在不设置填充的情况下将我的版权footer放入页脚的中心底部?有没有"正确"这样做的方式?

HTML

<footer class="footer">
    <div class="footerContainer">
        <p class="copyright">© GROUP TITLE 2015</p>
    </div>
</footer>

CSS

footer.footer {
    height: 300px;
    width: 100%;
    background-color: #333333;
}

p.copyright {
    color: #fff;
    line-height: 40px;
    font-size: 0.7em;
}
请帮忙。

3 个答案:

答案 0 :(得分:4)

试试这个CSS:

<style>
    footer {
        position: relative;
        height: 300px;
        width: 100%;
        background-color: #333333;
    }

    p.copyright {
        position: absolute;
        width: 100%;
        color: #fff;
        line-height: 40px;
        font-size: 0.7em;
        text-align: center;
        bottom:0;
    }
</style>

并将您的HTML调整为:

<footer>
    <p class="copyright">© GROUP TITLE 2015</p>
</footer>

这里是fiddle

答案 1 :(得分:3)

这应该有效。

nodeEnter
    .append("image")
  .attr("xlink:href", function(d) { return d.img; })
  .attr("x", "-12px")
  .attr("y", "-44px")
  .attr("width", "24px")
  .attr("height", "24px");

答案 2 :(得分:0)

你真的需要页脚和页脚容器吗?

无关紧要,您是想在页面的末尾还是在可见页面底部的所有位置?

页面末尾:

 CSS:

 footer {
       position: absolute;
       bottom:0; 
 }

如果你想要它在屏幕的底部(总是)

 CSS:

 footer {
       position: fixed;
       bottom:0; 
 }

你可以在www.w3schools.com中学习很多这些基础知识(指向位置属性页面)。

并且显然你必须关闭你打开的东西..