Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to center a footer div on a webpage

Tags:

html

css

I want to center my web page footer and create a reasonable gab between it and the above content. Currently, the footer has a line and paragraph joined to the above content. I can push down the content but the line does not move. I am sure the property I am missing out in my css style sheet. Could someone help?

This is my html mark up:

<div id="footer">
   <p>Copyright (c) 2010 mysite.com All rights reserved</p>
</div> 

Which css property can I use to solve this problem? A sample would be appreciated. Thanks.

like image 212
ibiangalex Avatar asked Oct 25 '10 08:10

ibiangalex


People also ask

How do I center a div footer?

If you set the width of your footer element to 50% (25% left margin + 50% width leaves an effective 25% right margin, thus centering the footer itself first) and set the text-align of the footer element to center, it will center the footer divs how you want.

How do you center a footer in HTML?

text-align: center <ul class="footerLogos" style="text-align: center; width: 100%;"> <li><img src="logo url"></li> <li... A couple ways you could do this. text-align: center <ul class="footerLogos" style="text-align: center; width: 100%;"> <li><img src="logo url"></li> <li...

How do I center my footer on the page?

Go to Insert > Page Numbers. Select a position (left, center, or right, and header or footer).

How do I center a div on my website?

You can do this by setting the display property to "flex." Then define the align-items and justify-content property to “center.” This will tell the browser to center the flex item (the div within the div) vertically and horizontally.


1 Answers

#footer{
    display: table;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}
like image 139
Farhad Ziaee Avatar answered Oct 14 '22 18:10

Farhad Ziaee