IE7 Shrink-to-fit bug

2019-07-15 11:11发布

问题:

The entire page is an iframe onto another website (in this case, jquery.com just for demo purposes). I have an overlay "Hello World", and if you click on the X it minimizes it (click again it will open it).

It all works fine on IE8, Firefox, Chrome, etc...

However in IE7 it extends the white background to the entire width (see screenshot). I believe it's something to do with the shrink-to-fit or shrink-wrapping.

回答1:

Testing with IE8 compatibility mode, if on div.sidebar I remove background-color: #fff, it's fixed. Removing it makes no visible difference to IE8/Firefox.

To get rid of the page scrollbar on the right in IE7, you need to set overflow: hidden on html and/or body.



回答2:

It is the use of width:inherit on your sidebar that ie7 doesnt like. If you can set a fixed width it should be fine.