Joe*_*elB 678 html css iframe noborder internet-explorer-6
如何从__CODE__我的网络应用程序中嵌入边框中删除边框?一个例子__CODE__是:
<iframe src="myURL" width="300" height="300">Browser not compatible.</iframe>
Run Code Online (Sandbox Code Playgroud)
__CODE__假设背景颜色一致,我希望从页面上的内容过渡到无缝的内容.目标浏览器只是IE6,不幸的是其他人的解决方案无济于事.
Dav*_*rab 1087
添加frameBorder属性(注意大写'B').
所以它看起来像:
<iframe src="myURL" width="300" height="300" frameBorder="0">Browser not compatible.</iframe>
Run Code Online (Sandbox Code Playgroud)
Ada*_*dam 142
在试图删除IE7中的边框之后,我发现frameBorder属性区分大小写.
您必须使用大写B设置frameBorder属性.
<iframe frameBorder="0" ></iframe>
Run Code Online (Sandbox Code Playgroud)
小智 74
根据iframe文档,不推荐使用frameBorder,并且首选使用"border"CSS属性:
<iframe src="test.html" style="width: 100%; height: 400px; border: 0"></iframe>
Run Code Online (Sandbox Code Playgroud)
xen*_*nox 54
除了添加frameBorder属性之外,您可能还需要考虑将滚动属性设置为"no"以防止出现滚动条.
<iframe src="myURL" width="300" height="300" frameBorder="0" scrolling="no">Browser not compatible. </iframe >
Run Code Online (Sandbox Code Playgroud)
小智 21
For browser specific issues also add frameborder="0" hspace="0" vspace="0" marginheight="0" marginwidth="0" according to Dreamweaver:
<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>
Run Code Online (Sandbox Code Playgroud)
使用HTML iframe frameborder属性
http://www.w3schools.com/tags/att_iframe_frameborder.asp
注意:对于IE 使用帧B顺序(上限B),否则将无效.但是,HTML5中不支持iframe frameborder属性.所以,请改用CSS.
<iframe src="http://example.org" width="200" height="200" style="border:0">
Run Code Online (Sandbox Code Playgroud)
您还可以使用滚动属性删除滚动 http://www.w3schools.com/tags/att_iframe_scrolling.asp
<iframe src="http://example.org" width="200" height="200" scrolling="no" style="border:0">
Run Code Online (Sandbox Code Playgroud)
您还可以使用HTML5中新增的无缝属性.iframe标记的无缝属性仅在Opera,Chrome和Safari中受支持.如果存在,它指定iframe看起来应该是包含文档的一部分(没有边框或滚动条).截至目前,标签的无缝属性仅在Opera,Chrome和Safari中受支持.但在不久的将来,它将成为标准解决方案,并将与所有浏览器兼容.http://www.w3schools.com/tags/att_iframe_seamless.asp
Style属性可用于 HTML5如果要删除框架的boder或任何可以使用style属性的内容.如下所示
代码在这里
<iframe src="demo.htm" style="border:none;"></iframe>
Run Code Online (Sandbox Code Playgroud)
添加frameBorder属性(Capital'B').
<iframe src="myURL" width="300" height="300" frameBorder="0">Browser not compatible. </iframe>
Run Code Online (Sandbox Code Playgroud)
您也可以通过这种方式使用JavaScript.它会在IE和其他浏览器中找到任何iframe元素并删除它们的边框(尽管你可以在非IE浏览器中设置"border:none;"的样式而不是使用JavaScript).即使在iframe生成并在文档中就位后使用它也会起作用(例如,用纯HTML而不是JavaScript添加的iframe)!
这似乎有效,因为IE会创建边框,而不是iframe期望的iframe元素,而是iframe的内容 - 在BOM中创建iframe之后.($ @&*#@ !!! IE !!!)
注意:如果父窗口和iframe来自SAME源(相同的域,端口,协议等),则IE部分仅起作用(当然).否则,脚本将在IE错误控制台中出现"访问被拒绝"错误.如果发生这种情况,您唯一的选择是在生成之前设置它,就像其他人注意到的那样,或者使用非标准的frameBorder ="0"属性.(或者只是让IE看起来很脏 - 我目前最喜欢的选项;))
花了我几个小时的工作到绝望的地方来解决这个问题......
请享用.:)
// =========================================================================
// Remove borders on iFrames
if (window.document.getElementsByTagName("iframe"))
{
var iFrameElements = window.document.getElementsByTagName("iframe");
for (var i = 0; i < iFrameElements.length; i++)
{
iFrameElements[i].frameBorder="0"; // For other browsers.
iFrameElements[i].setAttribute("frameBorder", "0"); // For other browsers (just a backup for the above).
iFrameElements[i].contentWindow.document.body.style.border="none"; // For IE.
}
}
Run Code Online (Sandbox Code Playgroud)
如果您放置iframe的页面的doctype是HTML5,那么您可以seamless像这样使用该属性:
<iframe src="..." seamless="seamless"></iframe>
Run Code Online (Sandbox Code Playgroud)
小智 6
添加 frameBorder 属性,或使用边框宽度为 0px; 的样式,或将边框样式设置为无。
使用以下 3 项中的任何一项:
<iframe src="myURL" width="300" height="300" style="border-width:0px;">Browser not compatible.</iframe>
<iframe src="myURL" width="300" height="300" frameborder="0">Browser not compatible.</iframe>
<iframe src="myURL" width="300" height="300" style="border:none;">Browser not compatible.</iframe>Run Code Online (Sandbox Code Playgroud)
小智 5
我尝试了以上所有内容,如果这对您不起作用,请尝试下面的CSS解决了我的问题.这只是告诉浏览器不添加任何填充或边距.
* {
padding:0px;
margin:0px;
}
Run Code Online (Sandbox Code Playgroud)
小智 5
在你的样式表中添加
{
padding:0px;
margin:0px;
border: 0px
}
Run Code Online (Sandbox Code Playgroud)
这也是一个可行的选择.
小智 5
如果您使用 iFrame 来适应整个屏幕的宽度和高度,我假设您不是基于 300x300 尺寸,您还必须将正文边距设置为“0”,如下所示:
<body style="margin:0px;">
Run Code Online (Sandbox Code Playgroud)
小智 5
<iframe src="mywebsite" frameborder="0" style="border: 0px solid white;">HTML iFrame is not compatible with your browser</iframe>
Run Code Online (Sandbox Code Playgroud)
此代码应该在 HTML 4 和 5 中都可以使用。
| 归档时间: |
|
| 查看次数: |
813505 次 |
| 最近记录: |