iframe和Firefox/IE的bug

Hel*_*nar 5 iframe

我尝试<iframe>将内容position: fixed;用于音乐播放器播放器栏以将其保留在页面底部.

演示:http://jsfiddle.net/ThinkingStiff/vhLeE/

HTML:

<iframe src="http://thinkingstiff.com"></iframe>
<div id="player">music player</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

body {
    margin: 0;
    height: 100%; 
}

iframe {
    border: 0;
    display: block;
    height: 100%;
    width: 100%;
}

#player {
    background-color: black;
    bottom: 0;
    color: white;
    left: 0;
    position: fixed;
    height: 30px;   
    width: 100%; 
}
Run Code Online (Sandbox Code Playgroud)

遗憾的是,这不适用于IE或Firefix 9,它只是在一个小高度窗口中显示内容:http://cl.ly/0y0T2I1R042c3G002H3y

我怎样才能解决这个问题 ?

小智 12

我之前已经看到了类似的问题,而且幸运的是,解决方法非常简单 - IE和Firefox只需要将html高度设置为100%.因此,将样式的第一个元素更新为:

html, body {
    margin: 0;
    height: 100%; 
}
Run Code Online (Sandbox Code Playgroud)

这应该够了吧.