Remove border from IFrame

2020-01-25 12:22发布

How would I remove the border from an iframe embedded in my web app? An example of the iframe is:

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

I would like the transition from the content on my page to the contents of the iframe to be seamless, assuming the background colors are consistent. The target browser is IE6 only and unfortunately solutions for others will not help.

23条回答
放我归山
2楼-- · 2020-01-25 12:57

After going mad trying to remove the border in IE7, I found that the frameBorder attribute is case sensitive.

You have to set the frameBorder attribute with a capital B.

<iframe frameBorder="0" ></iframe>
查看更多
欢心
3楼-- · 2020-01-25 12:58

Try

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

This will remove the border of your frame.

查看更多
够拽才男人
4楼-- · 2020-01-25 12:59

As per iframe documentation, frameBorder is deprecated and using the "border" CSS attribute is preferred:

<iframe src="test.html" style="width: 100%; height: 400px; border: 0"></iframe>
  • Note CSS border property does not achieve the desired results in IE6, 7 or 8.
查看更多
Evening l夕情丶
5楼-- · 2020-01-25 12:59
<iframe src="mywebsite" frameborder="0" style="border: 0px solid white;">HTML iFrame is not compatible with your browser</iframe>

This code should work in both HTML 4 and 5.

查看更多
我想做一个坏孩纸
6楼-- · 2020-01-25 13:03

I tried all of the above and if that doesn't work for you try the below CSS resolved the issue for me. Which just tells the browsers to not add any padding or margin.

* {
  padding:0px;
  margin:0px;
 }
查看更多
登录 后发表回答