SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    centering - ie7 not obeying auto align

    Even with something this basic, to center the page, IE 7 does not align left auto, firefox does.

    Code:
    #header {
    background:#999999;
    width:72%;
    margin-left: auto;
    margin-right: auto;
    }
    Is this why most sites align everything to the left?

    Also thinking about doing a min-width with this.

    Should everything really be shoved over to the left to design with css/div tags?

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,117
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    That should work in IE7. Have you included a doctype?

    Why not just write:

    Code:
    margin: 0 auto;
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  3. #3
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <!DOCTYPE HTML PUBLIC
    "-//W3C//DTD HTML 4.01 Transitional//EN">
    And this is the problem. Since
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    makes it center

    What would you suggest for a doctype?

    Am till debating xhtml vs html, taking into account mobile users.

    While am asking, would you use a container div or header/main/footer divs by themselves?

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,117
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by datadriven View Post
    What would you suggest for a doctype?
    Transitionial doctypes are only meant for ten+ year old browsers. No new sites should be using a transitional doctype, so definitely go with strict.

    Am till debating xhtml vs html, taking into account mobile users.
    It doesn't matter much, especially if you are serving the xhtml as html. HTML5 will pretty much kill this issue anyway, as far as I can see.

    While am asking, would you use a container div or header/main/footer divs by themselves?
    Are you asking about HTML5 elements? If so, I wouldn't use them yet, as they only work with hacks at the moment—especially in older browsers like IE8 and below.

    Otherwise, not sure what you are asking there.

    EDIT: O, maybe I do see. Well, it depends on your layout. I would probably use those separate divs anyway, but if you want bands of color across the screen, then go with the separate option.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •