(010)layout_ie6三像素bug

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>ie6_3px.html</title>
    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <style type="text/css">
        *{margin: 0; padding: 0;]}
        #side {width:120px; height:300px; background:#99ff99; float:left;_margin-right:-3px;}
        #main {height:300px; background:#99ffff;}
    </style>
  </head>
  
  <body>
        <div id="side">这是side内容</div>
        <div id="main">这是main内容</div>
  </body>
</html>

3像素bug是IE6的一个著名的bug,当浮动元素与非浮动元素相邻时,这个3像素的Bug就会出现。

IE6会在两个div中间加上3px的空隙,那么要解决这个问题,请在#side上加上_margin-right:-3px;记住,前边加上一下划线,这样这个样式专门针对IE6生效。IE7和FF下还会正常显示。

posted @ 2015-01-29 15:19  雪中飞雁  阅读(62)  评论(0)    收藏  举报