简体   繁体   English

有画面时在萤幕中心显示Div?

[英]Div in screen center when there are frames?

How can I place a div into the SCREEN (not page) center, 如何将div放入“屏幕”(而非页面)中心,
when the div is in an iframe, 当div位于iframe中时,
and the div's x position for being in the SCREEN center is 并且div在屏幕中心的x位置是
too far left for still being on the iframe page (div.x < iFramePage.x) ? 仍离iframe页太远(div.x <iFramePage.x)吗?



The iframe is in a table in the right row, and in the left row there is a navigation treeview. 该iframe位于右行的表格中,而在左行则有一个导航树视图。
Now my div should overlap the treeview, for being in the center... 现在我的div应该与树视图重叠,因为它位于中间...

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. iframe的内容将永远无法“离开”框架,相反,iframe将获得滚动条。

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. 这将违背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 . 正如Mef和Valamo回答的那样,无法将div对齐到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. 您可以考虑将div移到父文档(其中包含iframe ),而不是这样做,然后可以根据需要对齐div

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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