Margin Issue with IE

Discussion in 'CSS' started by cmiolla, May 24, 2010.

  1. #1
    Surprise, surprise I’m having formatting issues with IE7….

    I believe I’m having a problem with my margins. They appear to be creating double to triple the space I’m designating to div tags in regards to top and bottom designations.

    I tried “display: inline;” but that didn’t work, and broke in safari and FF.

    My website is chrismiolla.com and you will see the issue. It’s displaying fine in all other web
    browsers. The link to the css code is /css/ gallery.css.

    Does anyone have any suggestions?
     
    cmiolla, May 24, 2010 IP
  2. wab

    wab Member

    Messages:
    57
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #2
    you can target IE by using some css hacks like:
    
    .myClass{
        margin-top:...; /* or all the browsers except IE */
        _margin-top:...; /*for IE6 and below*/
        *margin-top:...; /*for IE7 and below*/
        margin-top:...\9; /* for IE8 and below */
    }
    
    Code (markup):
     
    wab, May 24, 2010 IP
  3. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #3
    Are you talking about #lines and #lines2? If so, IE <8 automagically causes an element with hasLayout to expand its height to enclose the inherited line height. That would make those divs 19px high. Set font-size and line-height to zero.

    You are asking for trouble not using a proper DTD. That causes IE <8 to render in quirks mode, where they use an invalid box model.

    cheers,

    gary
     
    kk5st, May 25, 2010 IP
  4. cmiolla

    cmiolla Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks Gary,

    The DTD code defiantly helped maintain a more consistent rendering of the site across all the web browsers, and forced me to fix a lot of mistakes in the code. It’s not perfect but it’s much better then it was before.
     
    cmiolla, May 27, 2010 IP