Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7922027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:48:41+00:00 2026-06-03T16:48:41+00:00

I try to center a div element ( the footer div in this case

  • 0

I try to center a div element ( the footer div in this case ) in my webpage but it insists on staying on the left side.

I am not quite sure what is wrong… Any ideas?
Thank you in advance.

HTML :

<div id='main'>
</div>

<div id='footer'>Centered Text</div>​

CSS :

* {
    padding: 0;
    margin:  0;
    font-size:   12px;
}

body {
    font-family: helvetica, serif;
    font-size:   12px;
    overflow-y:scroll;
}

#main {
    border: 1px solid #bbbbbb;
    margin: 3% 5%;
    padding: 10px 10px;
}

#footer {
    font-size: 75%;
    margin: 0px auto;
    position: absolute;
    bottom: 0px;
}

​

http://jsfiddle.net/DjPjj/2/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:48:45+00:00Added an answer on June 3, 2026 at 4:48 pm

    The reason it won’t center is because of the positon: absolute;.

    Keep in mind this means that the footer will always be at the bottom of the page, even if the content overflows past it. It will overlap. If you want to have it be attached to the bottom of the page, you must set the min-height of a container above it to 100% and then deal with a negative margin-top and remove the position: abosolute;

    http://jsfiddle.net/4fuk7/1/

    Notice how the centered text is overwritten.

    If you are looking for something to always be at the bottom, this would work
    http://jsfiddle.net/4fuk7/3/

    Sorry, the last one would scroll to the top. This one doesn’t, but you’d need to fiddle with it a bit to get it to properly align around the margin’s you’ve set. http://jsfiddle.net/4fuk7/9/
    http://www.tlunter.com/Layout 2/ is where I did something similar. You can reference that if you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Try to see which cast is faster (not necessary better): new c++ case or
Possible Duplicate: How to center DIV in DIV? Now i try <html> <head> <title>?????????????????</title>
I have a div which contains an img now I would center it but
I have this page: http://www.comehike.com/hiking.php <div style=align:center> <div id=fb-root></div> <script src=http://connect.facebook.net/en_US/all.js#appId=217585988283772&amp;xfbml=1></script> <fb:like href= send=true
I have this in HTML: <div class=dataBurst title=What is the Matrix?> <table align=center height=100%>
this is actually my first ZK project seems pretty cool but not working and
I am trying to parse this content using jsoup. <div class=imageInlineCenter style=width: 468px; align=center><img
I try to center a div on my page. It should use just relative
Several times I get this problem.Whenever I try to center something using margin:0 auto.
i try to position the elements like this but i get this the html

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.