当我使用下面的代码来创建一个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>

其他回答

用下面的代码代替它:

    <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>

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

body {
    margin: 0;
}

在带有iframe的页面中。

尝试添加以下属性:

scrolling="no"

使用帧边缘= " 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>

你可以使用这段代码:

  <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>