2011-04-15 77 views

回答

26

有没有什么办法可以裁剪下载页面的内容,只显示我网站上该页面的一部分?

否。同源策略可以防止您以任何方式操纵iframe,包括滚动位置。

会有一种解决方法通过将iframe成一个div容器,其具有限定的高度和宽度,以及overflow: hidden裁剪的视图端口:

<div style="width: 500px; height: 500px; overflow: hidden"> 

并给予iframe的相对位置:

<iframe src="..." style="position: relative; left: -100px; top: -100px"> 

这样,您可以调整页面上可见的iframe部分。然而,整个页面仍然呈现,并且这种方法不能抵抗诸如在iframe内滚动的影响。

4
<div style="position: absolute; left: 0px; top: 0px; border: solid 2px #555; width:594px; height:332px;"> 
<div style="overflow: hidden; margin-top: -100px; margin-left: -25px;"> 
</div> 
<iframe src="http://www.centricle.com/tools/html-entities/" scrolling="no" style="height: 490px; border: 0px none; width: 619px; margin-top: -60px; margin-left: -24px; "> 
</iframe> 
</div> 
</div> 

此代码适用于我。

来源[http://extechbuzz.blogspot.com/2012/12/iframe-how-to-display-specific-part-of.html]

0

要在嵌入式page底部剪切掉广告,我用下面的:

<div style="width: 1000px; height: 390px; overflow: hidden"> 
<iframe src="https://openflights.org/user/dankohn1" width="1000" 
height="600" style="border:none" scrolling="no"> 
</iframe></div> 
0

此代码为我工作...调整边距并保留任何最适合您的值,并将iframe的高度和宽度调整为您想要的任何值。

<html> 
<div style="overflow: hidden; margin-top: -1440px; margin-left:0;"> 
<iframe src="https://fiitjeelogin.com/StartPage.aspx" scrolling="no" height="1550"width="300" frameBorder="0"> 
</iframe> 
</div> 
</html>