Negative top margin not working in IE 8 or 9

前端 未结 5 602
悲哀的现实
悲哀的现实 2020-12-14 07:56

I have a div with margin-top:-200px. I want the div to move up/behind the div above it.

Works great in all browsers except IE so far. margin-top:

5条回答
  •  温柔的废话
    2020-12-14 07:59

    In order to support negative margins in IE, I've fixed similar issues with display: table;. Other fixes like zoom: 1; and position: relative; don't always work (at least in my experience). If you only want to add this style to IE, I'd suggest using https://modernizr.com/

    // using comment to show that .no-cssreflections belongs to the html tag
    /*html*/.no-cssreflections .container { display: table; } 
    

提交回复
热议问题