简体   繁体   中英

Div in screen center when there are frames?

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 ?

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"?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM