如何将版权页脚定位到页脚的中心底部?

Jam*_*owy 0 html css

如何footer在不设置填充的情况下将我的版权置于页脚的中心底部?有什么“正确”的方法吗?

HTML

<footer class="footer">
    <div class="footerContainer">
        <p class="copyright">© GROUP TITLE 2015</p>
    </div>
</footer>
Run Code Online (Sandbox Code Playgroud)

CSS

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

p.copyright {
    color: #fff;
    line-height: 40px;
    font-size: 0.7em;
}
Run Code Online (Sandbox Code Playgroud)

请帮忙。

Ian*_*Ian 6

试试这个 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>
Run Code Online (Sandbox Code Playgroud)

并将您的 HTML 调整为:

<footer>
    <p class="copyright">© GROUP TITLE 2015</p>
</footer>
Run Code Online (Sandbox Code Playgroud)

这是小提琴