当我使用下面的代码来创建一个iframe:

<iframe src="mypage.html" style="border: 0; width: 100%; height: 100%">Your browser doesn't support iFrames.</iframe>

iframe并没有一直延伸——一个10px的白色“边框”围绕着iframe。我怎么解决这个问题呢?

这是这个问题的一个图像:


当前回答

将这个添加到你的iframe中可能会解决这个问题:

frameborder="0"  seamless="seamless"

希望能有所帮助。

其他回答

尝试添加以下属性:

scrolling="no"

正文在大多数浏览器中都有默认的边距。试一试:

body {
    margin: 0;
}

在带有iframe的页面中。

将这个添加到你的iframe中可能会解决这个问题:

frameborder="0"  seamless="seamless"

希望能有所帮助。

你可以使用这段代码:

  <iframe src="http://example.com" frameborder="0" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:100%;width:100%;position:absolute;top:0%;left:0px;right:0px;bottom:0px" height="100%" width="100%"></iframe>

您可以尝试frameborder=0。