代码改变世界

【原】去掉WebBrowser内嵌网页时的边框(含有FrameSet的情况如何处理)

2010-08-17 20:51  刺客之家  阅读(1739)  评论(0编辑  收藏  举报

废话不多说,今天要做一个功能,使用了WebBrowser控件,和大多数人一样,我想去掉控件本身的边框,因为这个3D边框很丑陋而且和背景不相容。

 

找了一圈,发现网上的方法都是针对没有Frameset的情况,也就是说,你的页面如果有Frameset构成,则使用css:


body
{
 /*下面2句去掉webBrowser边框*/
 border:0px;
 overflow:hidden; 
 }

是不够的,边框仍然存在。

 

我的代码原来是

 

代码
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2  <html xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5  <link href="style.css" rel="stylesheet" type="text/css" />
6  <title></title>
7  </head>
8  <frameset framespacing="0" frameboder="no" rows="44px,*">
9
10  <frame id="frameNav" scrolling="no" name="frameNav" src="navigation.html" border="none" frameborder="no" noResize="true"></frame>
11 <frame id="frameContent"scrolling="no" name="frameContent" src="01-Content.html" border="none" frameborder="no" noResize="true"></frame>
12 </frameset>
13
14 </html>

 

 

 

后来改为:

 

代码
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <link href="style.css" rel="stylesheet" type="text/css" />
6 <title></title>
7 </head>
8 <body>
9 <iframe id="frameNav" frameborder="0" name="frameNav" height="44px" scrolling="no" width="699px" src="navigation.html"></iframe>
10 <iframe id="frameContent" frameborder="0" name="frameContent" height="456px" scrolling="no" width="699px" src="01-Content.html"></iframe>
11 </body>
12
13
14 </html>

用iframe来替代frameset,测试发现边框去掉了。

 

哪位达人知道不改html代码怎么实现,希望不吝赐教,thanks~

本博客文章若非标记转载,均为原创,转载请注明出处~