Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make my footer center to the bottom of the page?

I'm having trouble centering my footer to the bottom of the page. Here's my code

footer {
background-color: #FFF;
position:fixed;
bottom: 0px;
width: 400px;
text-align: center;
}
<footer align="center">
    <p>March 25, 2</p>
</footer>
like image 727
Diallo Dickerson Avatar asked Mar 26 '13 04:03

Diallo Dickerson


People also ask

How do I get my footer to sit at the bottom of the page?

Keep the footer at the bottom by using Flexbox Make sure that you are wrapping everything in a <div> or any other block-level element with the following CSS styles: min-height:100vh; display:flex; flex-direction:column; justify-content:space-between; .

Why does the footer not stick to the bottom?

The reason your footer is only halfway down the page with position: absolute is that you haven't set a min-height on the body and html elements. Without that, the body only takes up as much space as you have content for it -- and then the footer is aligned with that bottom, not the bottom of the window.

Why is my footer in the middle of my page?

When the footer margins are too narrow or the padding is too wide, the footer position shifts and can move to the middle of the Web page. One easy solution is to remove the margins and padding entirely, so that those footer properties correspond to the rest of the coding.

How do I center my footer at the bottom in CSS?

Add {text-align: center} to your footer region or block. You could specify a width for your block and add {margin: 0 auto}.


1 Answers

Just set width to 100%

width: 100%;
like image 118
Nasir Mahmood Avatar answered Oct 02 '22 12:10

Nasir Mahmood