【问题标题】:Competely removing an <iframe> border完全删除 <iframe> 边框
【发布时间】:2010-11-12 20:24:08
【问题描述】:

有人知道如何完全移除 iframe 边框吗?我正在使用 Firefox 3.x 并且 iframe 设置为完全占据浏览器窗口 - height="100%" width="100%"

我已经设置了frameBorder="0"scrolling="no",但是在窗口和 iframe 之间的边界处还有一些空间。 100% 的宽度和高度有问题吗?我需要设置超过 100% 吗?多少?

【问题讨论】:

  • iframe 在哪里?你能显示一些代码吗?

标签: html css


【解决方案1】:

你是指边距/内边距吗?

在您的 iframe 显示的 html 文件中,尝试以下 CSS:

body {
    margin: 0;
    padding 0;
}

编辑: 您的 iframe 元素本身也可能类似。 如果上述方法不起作用,在父 html 页面中尝试:

iframe {
    padding: 0;
    margin: 0;
}

【讨论】:

  • 它工作了 :) 身体上的 margin=0 工作 - 我犯了一些愚蠢的复制错误;更改未得到反映
  • 啊,那你去吧:)
【解决方案2】:

通过禁用 iframe 标签的边框,这对我有用:

iframe {
    border:none;
}

【讨论】:

    【解决方案3】:
    <style>
        html,body, div, iframe{
            height: 100%;
            overflow: hidden;
            margin: 0; padding: 0;
        }
    </style>
    
    <iframe src="http://www.cnn.com" frameborder="no"></iframe>
    

    请参阅http://api.fatherstorm.com/test/4159620.php 了解示例

    【讨论】:

    • 如果要支持
    【解决方案4】:
    hspace="0" vspace="0" marginHeight = "0" marginWidth = "0" scrolling= "no" frameBorder="0"                              allowtransparency="true"
    

    【讨论】:

      【解决方案5】:

      我在 Firefox 中使用border: none; 来解决这个问题。

      【讨论】:

        猜你喜欢
        • 2010-09-09
        • 2011-11-11
        • 1970-01-01
        • 1970-01-01
        • 2012-05-03
        • 1970-01-01
        • 2011-08-06
        • 1970-01-01
        相关资源
        最近更新 更多