【发布时间】:2011-10-07 18:43:40
【问题描述】:
我在我的页面中使用 iframe,并且偶然发现了一个奇怪的问题。我像这样设置iframe css
iframe {
margin: none;
padding: none;
background: blue; /* this is just to make the frames easier to see */
border: none;
}
但是,iframe 周围仍有空白。我在 Chrome 和 Firefox 中都测试过,结果是一样的。我四处寻找,我找不到任何东西。这个空格也不会出现在 Chrome 控制台中。 另外,我也已经有了以下 CSS:
html, body {
margin: 0px;
padding: 0px;
border: 0px;
width: 100%;
height: 100%;
}
JSFiddle:here
【问题讨论】:
-
Tested 在 chrome、IE 和 FF(在我这端)上看不到边框。它可能是它所在的容器。(我知道我设置了一个大小,但我的预期是 iframe 的边距会扩大其父级以适应 - 没有这样的结果。)
-
@BradChristie 那我该怎么办? iframe 就在我的 body 标签中。
-
你能制作一个 jsfiddle 复制你所拥有的吗? (将整个 html 源代码放在左上角的窗口中,然后单击保存并提供该链接。)
-
请发布您的html内容,有点难以弄清楚[jsfiddle.net/yELzF/]
标签: html css iframe whitespace removing-whitespace