1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 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 <title>无标题文档</title> 6 7 <style type="text/css"> 8 .div{ width:501px;/*ie6下产生1px的bug,如果修改为500px或者是偶数像素则可以解决*/ background:#009; height:500px; position:relative} 9 .div .box{ height:200px; width:100px; background:#FF0000; position:absolute; right:0; top:0} 10 </style> 11 12 </head> 13 14 <body> 15 16 <div class="div"> 17 <div class="box"></div> 18 19 </div> 20 </body> 21 </html>
解决办法:就是将父容器的宽度设置为偶数