开发者

ie7: absolute div in centered relative parent behaving strangely

开发者 https://www.devze.com 2023-03-28 00:06 出处:网络
The is开发者_如何学Gosue is best explained with pictures, but you can try it for yourself here:

The is开发者_如何学Gosue is best explained with pictures, but you can try it for yourself here:

http://pastehtml.com/view/b3y7e9uz6.html

Simply compare ie7 to (ie8 or ff or chrome). It looks like this in modern browsers:

ie7: absolute div in centered relative parent behaving strangely

and like this in ie7:

ie7: absolute div in centered relative parent behaving strangely

What is causing it to be offcenter in ie7?


As soon as you remove the position: absolute everything corrects itself, minus the red border; however, that is extremely easy to solve by applying the appropriate borders to the sides you want them on.

If you must keep the position: absolute add left: 0 and that appears to correct it as well. IE7 probably requires a left/right or gets slightly messed up as it doesn't know where to position it.

0

精彩评论

暂无评论...
验证码 换一张
取 消