调整iframe的大小以适应其他页面

Resize an iframe to fit within another page

本文关键字:其他 iframe 调整      更新时间:2023-09-26

我正试图将(我网站上一个页面的)iframe添加到我网站的另一个页面。我已经找到了iframe的代码,并使用div获取了其中的一部分。现在我想缩小整个网页(在iframe中),以适应我添加它的页面。我如何更改以下代码?

<div style="border:0; overflow: hidden; margin: 15px auto; max-width: 736px;">
<iframe scrolling="no" src="http://www.tryary.com/forums/topic/21/best-law-of-attraction-books/post-create?" style="border: 0px none; margin-left: -0px; height: 1000px; margin-top: -333px; width: 726px;">
</iframe>
</div>

如果你只想适应iframe的大小,那么在html 中检查下面的代码

HTML

<div id="output" style="width:500px;height:400px;">
    <iframe src="www.google.com" style="width:100%;height:100%;" id="ifrm"></iframe>
</div>

如果您希望内容也被收缩,那么使用如下所示的css转换

CSS

#ifrm {
    -ms-transform: scale(0.5); /* IE 9 */
    -webkit-transform: scale(0.5); /* Safari */
    transform: scale(0.5);
}