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

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

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


当前回答

对于特定于浏览器的问题,还可以根据Dreamweaver添加frameborder=“0”hspace=“0“vspace=“1”marginheight=“2”marginwidth=“0”:

<iframe src="test.html" name="banner" width="300" marginwidth="0" height="300" marginheight="0" align="top" scrolling="No" frameborder="0" hspace="0" vspace="0">Browser not compatible. </iframe>

其他回答

如果您使用iFrame来适应整个屏幕的宽度和高度(我假设您不是基于300x300尺寸),则还必须将主体边距设置为“0”,如下所示:

<body style="margin:0px;">

添加frameBorder属性(大写“B”)。

<iframe src="myURL" width="300" height="300" frameBorder="0">Browser not compatible. </iframe>
iframe src="XXXXXXXXXXXXXXX"
marginwidth="0" marginheight="0" width="xxx" height="xxx"

适用于Firefox;)

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

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

在样式表中添加

{
  padding:0px;
  margin:0px;
  border: 0px

}

这也是一个可行的选择。