如何从嵌入在web应用程序中的iframe中删除边框?iframe的一个示例是:

<iframe src="myURL" width="300" height="300">Browser not compatible.</iframe>

我希望从页面上的内容到iframe内容的转换是无缝的,假设背景颜色是一致的。目标浏览器仅为IE6,不幸的是,针对其他浏览器的解决方案将无济于事。


当前回答

1.通过内联样式集边框:0

 <iframe src="display_file.html" style="height: 400px; width:
   100%;border: 0;">HTML iFrame is not compatible with your browser
   </iframe>

2.通过标记属性框架边框集0

<iframe src="display_file.html" width="300" height="300" frameborder="0">Browser not compatible.</iframe>

3.如果我们有多个I帧,我们可以在内部或外部给class和Put css。

HTML格式:

<iframe src="display_file.html" class="no_border_iframe">
    HTML iFrame is not compatible with your browser 
</iframe>

CSS:

<style>
.no_border_iframe{
border: 0; /* or border:none; */
}
</style>

其他回答

对我来说,添加非常有效

.iframe{
box-shadow: none !important;
}

这个解决方案特别适用于我正在编辑的shopify主题。shopify主题在整个主题中以不同的方式使用iframe,其中一个出现了故障。我不得不手动进入css并覆盖css属性。

我有一个底部白色边框的问题,我无法用边框、边距和填充规则解决它。。。所以添加display:块;因为iframe是一个内联元素。

这将考虑HTML中的空白。

使用HTML iframe frameborder属性

http://www.w3schools.com/tags/att_iframe_frameborder.asp

注意:IE使用frameBorder(cap B),否则将无法工作。但是,HTML5不支持iframeframeborder属性。因此,请改用CSS。

<iframe src="http://example.org" width="200" height="200" style="border:0">

也可以使用滚动属性删除滚动http://www.w3schools.com/tags/att_iframe_scrolling.asp

<iframe src="http://example.org" width="200" height="200" scrolling="no" style="border:0">

此外,您还可以使用HTML5中新增的无缝属性。iframe标签的无缝属性仅在Opera、Chrome和Safari中受支持。当出现时,它指定iframe看起来应该是包含文档的一部分(没有边框或滚动条)。目前,标签的无缝属性仅在Opera、Chrome和Safari中受支持。但在不久的将来,它将成为标准解决方案,并与所有浏览器兼容。http://www.w3schools.com/tags/att_iframe_seamless.asp

Try

<iframe src="url" style="border:none;"></iframe>

这将删除框架的边框。

除了添加frameBorder属性之外,您还可以考虑将滚动属性设置为“否”,以防止出现滚动条。

<iframe src="myURL" width="300" height="300" frameBorder="0" scrolling="no">Browser not compatible. </iframe >