The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Design centering a footer when margin: 0 auto; is not working

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #248875



    text i want to be centered



    footer {
    clear: both;
    margin: 0 auto;
    background-color: rgb(153, 76, 0);
    padding: 50px;


    #footer {
    margin: 0 auto;

    this is not working, and ideas on why or how i can change it??


    The footer element is a block level element by default, so it spans 100% of its container (unless any other styles are applied to alter that). Something that is 100% width of the container is already centered per se, so auto-ing the left and right margin will have no visual effect. It seems more likely that you’re trying to centre the elements that are inside the footer sotext-align:center; might be more appropriate here. However, the success of text-align:center; depends on what’s inside that you’re trying to centre, and those element’s defined styles. We’d really need to see what you’re working with to be able to offer specific help. If the previous suggestion doesn’t work, provide a reduced demo in CodePen and we can take a look.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Design’ is closed to new topics and replies.