Html 完全删除 <iframe> 边框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4168754/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Competely removing an <iframe> border
提问by Kshitij Saxena -KJ-
Does anybody know how to completelyremove an iframe border? I am using Firefox 3.x and the iframe is set to completely occupythe browser window - height="100%"
width="100%"
有人知道如何完全删除 iframe 边框吗?我正在使用 Firefox 3.x 并且 iframe 设置为完全占据浏览器窗口 -height="100%"
width="100%"
I have already set frameBorder="0"
and scrolling="no"
but there is some space remaining at the border between the window and the iframe. Is the problem with 100% width and height? Do I need to set more than 100%? By how much?
我已经设置了frameBorder="0"
,scrolling="no"
但是在窗口和 iframe 之间的边界处还有一些空间。100% 宽度和高度有问题吗?我需要设置超过 100% 吗?到多少?
回答by Hardeep
Do you mean the margin/padding?
你的意思是边距/填充?
In the html file your iframe is displaying try the following CSS:
在您的 iframe 显示的 html 文件中,尝试使用以下 CSS:
body {
margin: 0;
padding 0;
}
edit:It could also be similar for your iframe element itself. If the above doesn't work, in the parent html page try:
编辑:您的 iframe 元素本身也可能类似。如果上述方法不起作用,请在父 html 页面中尝试:
iframe {
padding: 0;
margin: 0;
}
回答by Alexander
This worked for me by disabling border to iframe tags :
这通过禁用 iframe 标签的边框对我有用:
iframe {
border:none;
}
回答by FatherStorm
<style>
html,body, div, iframe{
height: 100%;
overflow: hidden;
margin: 0; padding: 0;
}
</style>
<iframe src="http://www.cnn.com" frameborder="no"></iframe>
see http://api.fatherstorm.com/test/4159620.phpfor an example
回答by Deepak Patil
hspace="0" vspace="0" marginHeight = "0" marginWidth = "0" scrolling= "no" frameBorder="0" allowtransparency="true"
回答by Atlas S. Harper
I use border: none;
to fix this issue in Firefox.
我用来border: none;
在 Firefox 中解决这个问题。