z-index does not work in Internet Explorer with pdf in iframe

2271 ワード

I know of one technique to reliably occlude windowed controls in IE with other elements, but you're not going to like it.
Background: windowed and windowless elements
IE categorises elements into two types: windowed and windowless. Regular elements like div and input are windowless, rendered directly by the MSHTML engine. Windowed elements, however, are rendered in a separate MSHTML plane and get painted over any elements intruding in the space reserved for them. They respect z-index for each other, but always paint on top of windowless elements.
The only exception to this rule is iframe. In IE 5, iframe was a windowed element. This was changed in IE 5.5; it is now a windowless element, but for backwards compatibility reasons it will still draw over windowed elements with a lower z-index. Crucially, it also respects z-index for windowless elements—so if you position an iframe over a windowed element, any windowless elements you position over the iframe will be visible.
What this means
Essentially, the PDF is painted on top of the regular page content—like select elements were until IE 7. The easiest fix is to use another iframe positioned between your content and the PDF.
Demo
jsFiddle: http://jsfiddle.net/Jordan/gDuCE
Code
HTML:
my text that should be on top