ff vs ie - div width

Discussion in 'CSS' started by daboss, Oct 2, 2006.

  1. #1
    i'm having this problem with skinning a new site:

    in ie, the width of a div = actual width + padding

    in ff, the width = actual width, padding is additional width...

    as such, if the site looks ok in ie, it's out in ff... and vice versa... i've searched around and although this is discussed in other forums, there is no solution.

    anyone know how to overcome this?
     
    daboss, Oct 2, 2006 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    Use a complete and proper DTD to kick IE into standards mode, where it will use the correct box model.
    
    html
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    
    or xhtml
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    Code (markup):
    See http://www.w3.org/QA/2002/04/valid-dtd-list.html for all DTDs.

    cheers,

    gary
     
    kk5st, Oct 2, 2006 IP
  3. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #3
    But don't use XHTML unless you are prepared to send it as application/xhtml+xml and dynamically render it into HTML conditionally for Internet Explorer.

    XHTML sent as text/html is not parsed as XML in XHTML-capable UAs and application/xhtml+xml is not recognised as a render-able MIME type by IE.

    Fun, isn't it? :)
     
    penagate, Oct 2, 2006 IP
  4. daboss

    daboss Guest

    Messages:
    2,249
    Likes Received:
    151
    Best Answers:
    0
    Trophy Points:
    0
    #4
    eh? from what i see i thought it was ff that is giving the problem... ???
     
    daboss, Oct 2, 2006 IP
  5. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #5
    No. Mozilla behaviour is correct, it uses the proper W3C box model. IE in quirks mode uses the original broken MS interpretation that you describe in your first post. Implement Gary's suggestion of a proper strict doctype declaration and IE will use the W3C box model, which means it will then behave as Mozilla does. Fix your CSS to work in the W3C model and then you will be fine.

    In 90% of cases, if there is any discrepancy between MSIE and Mozilla, Mozilla is usually correct. Check other browsers as well, such as Opera, and you will see they usually match Moz's behaviour.
     
    penagate, Oct 2, 2006 IP