Margin css

Discussion in 'CSS' started by kevbo22, Apr 25, 2011.

  1. #1
    Does anybody know why this margin would be a problem in ie7:
    margin: 20px auto;
    Runs great in all other browsers including ie8. Why wouldn't it run in ie7? Thanks
     
    kevbo22, Apr 25, 2011 IP
  2. karthimx

    karthimx Prominent Member

    Messages:
    4,959
    Likes Received:
    127
    Best Answers:
    2
    Trophy Points:
    340
    #2
    That is browser compatibility problem, IE always stands out.
     
    karthimx, Apr 25, 2011 IP
  3. buzenko

    buzenko Peon

    Messages:
    93
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You use DOCTYPE?
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    HTML:
    Or add parent container property text-align:center;
     
    buzenko, Apr 25, 2011 IP
  4. kevbo22

    kevbo22 Active Member

    Messages:
    149
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Actually I am using strict not transitional. and it runs great in all browsers except ie7. Is there a problem with ie7 and is there an ie7 hack for this? the auto is working and centering it is the margin of 20px that is not working. My margin on top and bottom dont work in ie7.
     
    kevbo22, Apr 25, 2011 IP
  5. sburst

    sburst Peon

    Messages:
    39
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Add to your head:

    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
    Code (markup):
    it will force IE7 into thinking it's IE8 and behave (probably).
     
    sburst, May 11, 2011 IP