Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Iframe and Firefox/IE bug

Tags:

iframe

I try <iframe> for the content and use position: fixed; for a music player player bar to keep it at the bottom of the page.

Demo: http://jsfiddle.net/ThinkingStiff/vhLeE/

HTML:

<iframe src="http://thinkingstiff.com"></iframe>
<div id="player">music player</div>

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%; 
}

Sadly this doesn't work well for IE or Firefix 9, it simply shows the content in a small height window: http://cl.ly/0y0T2I1R042c3G002H3y

how can I fix this ?

like image 790
Hellnar Avatar asked Jan 03 '12 23:01

Hellnar


1 Answers

I've seen a similar problem before with things I've worked on, and fortunately the workaround is really simple -- IE and Firefox just need the html height to be set to 100% as well. So update the first element of your style to be:

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

That should do the trick.

like image 102
Rob Wilkins Avatar answered Jan 04 '23 10:01

Rob Wilkins