当我使用下面的代码来创建一个iframe:
<iframe src="mypage.html" style="border: 0; width: 100%; height: 100%">Your browser doesn't support iFrames.</iframe>
iframe并没有一直延伸——一个10px的白色“边框”围绕着iframe。我怎么解决这个问题呢?
这是这个问题的一个图像:
当我使用下面的代码来创建一个iframe:
<iframe src="mypage.html" style="border: 0; width: 100%; height: 100%">Your browser doesn't support iFrames.</iframe>
iframe并没有一直延伸——一个10px的白色“边框”围绕着iframe。我怎么解决这个问题呢?
这是这个问题的一个图像:
当前回答
使用帧边缘= " 0 "。下面是一个完整的例子:
<iframe src="mypage.htm" height="100%" width="100%" frameborder="0">Your browser doesnot support iframes<a href="myPageURL.htm"> click here to view the page directly. </a></iframe>
其他回答
不可能在没有看到一个活生生的例子的情况下说,但尝试给两个主体边框:0px
用下面的代码代替它:
<frameset rows="100%,*">
<frame src="-------------------------URL-------------------------------">
<noframes>
<body>
Your browser does not support frames. To wiew this page please use supporting browsers.
</body>
</noframes>
</frameset>
您可以尝试frameborder=0。
要覆盖整个视口,你可以使用:
<iframe src="mypage.html" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;">
Your browser doesn't support iframes
</iframe>
并且确保将框架页面的边距设置为0,例如body {margin: 0;}。-实际上,这个解决方案不需要这样做。
我成功地使用了这个,有一个额外的显示:none和JS显示它时,用户单击适当的控件。
注意:要填充父视图区域而不是整个视口,将position:fixed改为position:absolute,并确保父视图的位置不是静态的。
将这个添加到你的iframe中可能会解决这个问题:
frameborder="0" seamless="seamless"
希望能有所帮助。