Results 1 to 5 of 5

Thread: In IE: centered, In Firefox: to the left

  1. #1
    Join Date
    May 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question In IE: centered, In Firefox: to the left

    http://dr-haisook.blogspot.com/

    My website is aligned to the center in Internet Explorer, while in Firefox it's aligned to the left.

    I wonder: how can I center it in Firefox as well ?!

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Haisook
    My website is aligned to the center in Internet Explorer, while in Firefox it's aligned to the left.
    That's because IE is broken, and it's using the text-align property - which, as it's name suggests, applies to text and other in-line content - to affect the position of block-level elements.

    Block-level elements can be centred by applying a width or max-width property value other than auto, and setting auto left and right margins.

    Code:
    #container {
      margin: 0 auto;
      width: ??em;
    }
    Mike

  3. #3
    Join Date
    May 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks Mike, but...

    Where exactly should I put these codes? [You can view my source]

    Sorry, I'm not that experienced with HTML codes.

  4. #4
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    To use what I posted, you'll first have to create a wrapper element, with the id attribute value, container (though you could change that, obviously):

    HTML Code:
    <div id="container">
      <!-- The content you want centred -->
    </div>
    It's then just a matter of adding the rule in my previous post to your existing style sheet. You'll obviously need to alter the value for the width property; a value of around 40-50em should be fine.

    Hope that helps,
    Mike

  5. #5
    Join Date
    May 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks

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
  •