Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

position:fixed inside of an iframe

Tags:

css

iframe

For some reason, if I load an html page that has position:fixed on something, but I load it in an iframe, the fixed positions to not seem to render as fixed, but look more like absolute positioning.

I'm not expecting the fixed divs to be fixed relative to the parent document. I would just think that they would be fixed in the iframe. Is this not possible in an iframe?

like image 431
crickeys Avatar asked Nov 29 '11 00:11

crickeys


2 Answers

Chrome has a bug that doesn't fix elements with position:fixed if:

a) you use CSS3 transform in any element, and/or

b) you have a child element positioned outside the box of it's parent element

Oddly enough, the bug was reported back in 2009 and it's still open: https://code.google.com/p/chromium/issues/detail?id=20574

like image 130
Nighto Avatar answered Oct 17 '22 12:10

Nighto


They seem to be fixed to the iframe based off this fiddle: http://jsfiddle.net/ww9mK/6/ (note: jsfiddle uses an iframe and my height's and width's were just to test scrolling).

like image 44
ScottS Avatar answered Oct 17 '22 11:10

ScottS