简体   繁体   English

正确删除<iframe>边框

[英]Competely removing an <iframe> border

Does anybody know how to completely remove an iframe border? 有谁知道如何完全删除iframe边框? I am using Firefox 3.x and the iframe is set to completely occupy the browser window - height="100%" width="100%" 我使用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. 我已经设置了frameBorder="0"scrolling="no"但是在窗口和iframe之间的边界处还有一些空间。 Is the problem with 100% width and height? 100%宽度和高度的问题是? Do I need to set more than 100%? 我需要设置超过100%吗? By how much? 多少钱?

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. 编辑:对于你的iframe元素本身也可能类似。 If the above doesn't work, in the parent html page try: 如果以上不起作用,请在父html页面中尝试:

iframe {
    padding: 0;
    margin: 0;
}

This worked for me by disabling border to iframe tags : 通过禁用border to iframe标记,这对我有用:

iframe {
    border:none;
}
<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.php for an example 有关示例,请参阅http://api.fatherstorm.com/test/4159620.php

hspace="0" vspace="0" marginHeight = "0" marginWidth = "0" scrolling= "no" frameBorder="0"                              allowtransparency="true"

I use border: none; 我用border: none; to fix this issue in Firefox. 在Firefox中修复此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM