crickeys
crickeys

Reputation: 3115

position:fixed inside of an 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?

Upvotes: 7

Views: 28648

Answers (3)

Nighto
Nighto

Reputation: 4202

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

Upvotes: 9

Wojciech Bednarski
Wojciech Bednarski

Reputation: 6373

Here is similar question fixed vertical positioning of css within an iframe

It looks like there is no problem with position fixed to be fixed to the iframe. Example: http://digitaldreamer.net/media/examples/iframe-site.html

Can you provide code you are working on?

Upvotes: 1

ScottS
ScottS

Reputation: 72261

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).

Upvotes: 1

Related Questions