读书人

简单效果如何兼容多浏览器

发布时间: 2012-03-05 11:54:01 作者: rapoo

简单效果怎么兼容多浏览器

HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>    <title>无标题页</title>    <style type="text/css">    .p1{        border:solid 2px red;        width:200px;        height:100px;    }    .p2{        border:solid 2px blue;        width:200px;        height:200px;    }    </style></head><body>    <div class="p1">        <div class="p2"></div>    </div></body></html>ie6显示的两个DIV一样大,而其他浏览器 p2都比p1大真想把IE6杀了。我在p1中加了 overflow:hidden   其他浏览器的两个DIV一样大了。郁闷如何让IE6和其他浏览器显示一样。


[解决办法]
HTML code
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     <html xmlns="http://www.w3.org/1999/xhtml">   <head>       <title>无标题页 </title>       <style type="text/css">      .p1{          border:solid 2px red;          width:200px;          height:100px;      position:relative;     }      .p2{          border:solid 2px blue;          width:200px;          height:200px;      position:absolute;     }       </style>   </head>   <body>       <div class="p1">           <div class="p2"> </div>       </div>   </body>   </html> 

读书人网 >跨浏览器开发

热点推荐