views:

53

answers:

3

How can I place a div into the SCREEN (not page) center,
when the div is in an iframe,
and the div's x position for being in the SCREEN center is
too far left for still being on the iframe page (div.x < iFramePage.x) ?



The iframe is in a table in the right row, and in the left row there is a navigation treeview.
Now my div should overlap the treeview, for being in the center...

How can I do that ?

+1  A: 

You can't. That would defy the point of an iframe. And it could also be used to display ads outside of the box in which they paid to be displayed. And nobody wants that, do they...

Tor Valamo
+4  A: 

You can't. The contents of an iframe will never be able to "leave" the frame, instead, the iframe will get scrollbars.

No offense, but this sounds like a poor site architecture anyways. Maybe you should have a look at (lightweight) content management systems. Having that said, maybe you have a very very grace reason for this "architecture"?

Mef
Maybe Microsoft should just fix the bugs in their rendering engine, then I wouldn't need an iframe. Firefox and Chrome would work, but not IE.I've found a solution non-the less: place the div on the parent page with display: none or visibility: hidden, and make it visible via javascript from the iframe ;-))
Quandary
+1  A: 

As Mef and Valamo answerd, it's not possible to align the div in center of the page which is inside an iframe. Instead of doing this, you can consider moving the div to the parent document (which contains the iframe) and you can align the div as you want.

Veera