Forums

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

Home Forums CSS Center align entire webpage

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #39156
    markhatter
    Member

    Hi

    For some reason, my website won’t align in the center on all browsers. Seems to be an issue is IE and also on IOS browsers
    http://poppyandpaige.com/blog/
    Any ideas would be most appreciated!

    Thanks
    Mark

    #107133
    AntonNiklasson
    Participant

    Stop using the center element, it’s not semantic. What if you want to change how the site is layed out? Then you’d have to change the markup.

    To center an element, you can set both the left and right margins to auto. Like this:

    #wrapper {
    margin: 0 auto;
    }

    In some older versions of IE that won’t work though, so you’ll have to do it like this:

    body {
    text-align: center;
    }
    #wrapper {
    text-align: left;
    }
    #107199
    markhatter
    Member

    Hi

    Thanks for the info. I’ve tried what you suggested but it’s still left aligned on my iPhone.

    Is it anything to do with some elements having absolute positioning?

    Thanks again
    Mark

    #107246
    devsign
    Member

    What Anton Suggested is indeed correct, however, remember that you must also specify a width on anything you want centred. So just confirm that you do specify a width.

    #107250
    markhatter
    Member

    Hiya,

    Thanks for the comments. I have specified the width but it still doesn’t center align!

    I think it’s something to do with the code in the header section as if I remove the header graphics it aligns correctly!

    Thanks
    Mark

    #107251
    Paulie_D
    Moderator

    It may not be related but you have put the large image as an element rather than applying it as a background.

    You have (.bg) class but apparently aren’t using it except for positioning.

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