Forums

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

Home Forums CSS [Solved] Problems with centring div

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #172162
    ogmiios
    Participant

    Hi there, I’ve been writing a code for a custom page on my blog. I’m trying to make the page look similar to the theme on the rest of my blog, so I’m copying the parts of the CSS that I need. I’ve replicated most of the look but I’m having trouble with centring the content; it’s centred on my blog but left-alligned on the custom page. This is what I have in the CSS:

    #container, #content {
    width: 700px;
    margin: 50px auto;
    overflow: hidden;
    font: normal 12px Georgia, ‘Times New Romans’, Times, serif;
    }

    It’s copied directly so I thought it should work the same. I’ve googled the problem and it seems like having ‘auto’ should work but it’s not, and I haven’t seen any other suggestions. Any help would be appreciated, thanks!

    Edit:
    Could it be that a float: left on the header links is affecting it? The CSS looks like this:

    header .links ul li {
    float: left;
    margin: 0 10px 0 0;
    list-style-type: none;
    }

    I don’t think I can remove that float if that’s the problem, so is there any other way to centre? Then again, auto seems to work fine on the page I’m copying from and that has the float too, so I’m not sure where I’m going wrong.

    This is the code: http://codepen.io/anon/pen/daDAJ

    #172184
    ogmiios
    Participant

    Thank you so much! That worked perfectly . I knew I was probably just missing something simple!

    #172199
    lkeeney
    Participant

    I have a question unrelated to your problem. How were you able to mark your post as “Resolved”?

    I haven’t been able to figure this out yet.

    #172204
    Paulie_D
    Member

    At the moment, you can’t (although we used to be able to do so).

    At the moment, I do that as an added level of service.

    Of course, if you are the original poster, you should, I think, be able to edit your first post…and just change the title.

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