如何将页脚中心放在页面底部?

Dia*_*son 11 html css center footer web

我无法将页脚放在页面底部.这是我的代码

footer {
background-color: #FFF;
position:fixed;
bottom: 0px;
width: 400px;
text-align: center;
}
<footer align="center">
    <p>March 25, 2</p>
</footer>
Run Code Online (Sandbox Code Playgroud)

Nas*_*ood 15

只需将宽度设置为100%

width: 100%;
Run Code Online (Sandbox Code Playgroud)


jhu*_*lio 5

Shabbir Lakdawala 的答案是您的选择之一,但将floated元素包裹在您footer刚刚添加的“div”包装器中

html

<div class="footerWrap">
    <div class="footer">
      <div class="footerContent">
        <p>Lorem Ipsum dolor</p>
      </div>     
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

css

.footerWrap {
    width:100%;
    position:fixed;
    bottom: 0px;
}
.footer {
    width:400px;
    margin:auto;
}
.footerContent {
    float:left;
    width:100%;
    background-color:#555;
    padding:20px 0;
}
.footer p {float:left; width:100%; text-align:center; }
Run Code Online (Sandbox Code Playgroud)

工作演示