CSS height 100% in IE7

时光总嘲笑我的痴心妄想 提交于 2019-12-01 22:40:31

问题


I have a difficult layout in my website and I have a problem now with IE7. How can I in this example set the inner wrapper to fill the height of the outer wrapper?

http://jsfiddle.net/fMPNw/2/


回答1:


You have to explicitly define the height of .wrapper, in that situation. That being said, if your top: and bottom: attributes are going to make the height dynamic, your only solution is resetting the height with JavaScript, binding the height to update on window resize, etc.




回答2:


I was able to get .wrapper2 to layout correctly by making it absolutely positioned. Using the following 2 lines of CSS, width to correct the width issue caused by absolute positioning.

position:absolute;
width:100%;

End result being:

.wrapper{
    position: absolute;
    top: 310px;
    bottom: 130px;
    border: 1px solid red;
    width: 100px;
}
.wrapper2{
    border: 1px solid blue;
    height: 100%;
    width:100%;
    position:absolute;
}


来源:https://stackoverflow.com/questions/8160417/css-height-100-in-ie7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!