IE6-浮动margin产生双倍距离的问题
2012-07-12 13:56
302 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="Keywords" content="" /> <meta name="Description" content="" /> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <style type="text/css"> *{padding:0;margin:0;} .wrapper{width:500px;margin:0 auto;background:red;} .left{float:left;display:inline;width:200px;height:250px;margin-left:50px;background-color:green;} .right{float:left;display:inline;width:200px;height:250px;margin-left:50px;background-color:yellow;} </style> </head> <body> <div class="wrapper"> <div class="left"></div> <div class="right"></div> </div> </body> </html>
自己的理解结合网上知识
解决的方法是给浮动的元素加上display:inline;为什么要加inline呢?
因为left对象是相对于他的父级时才会产生双倍的距离,【只有第一个相对于父级浮动的子元素才会产生双倍的margin】
inline是不存在双倍距离的问题的而且在left对象浮动的时候触发了ie6的特有属性haslayout把inline转换成了inline-block
因为inline-block他是行内块元素他支持给他定义高度宽度和margin我简称他为(伪块元素)
相关文章推荐
- DIV+CSS设计IE6浮动产生双倍距离
- 解决浮动后IE6会产生双倍的距离
- IE6下margin时,float浮动产生双倍边距
- 在IE6里面当元素浮动后再设置margin那么就会产生双倍边距
- CSS FLOAT 扫盲之ie6 下双倍margin问题
- ie6 margin双倍问题
- IE6双倍浮动间距的问题解决
- ie6 margin 双倍边距问题
- IE6兼容性,双倍距离margin
- ie6 margin双倍问题
- 在IE6下 浮动 margin-bottom会消失问题
- IE6下 左浮动ul自动产生左边距问题
- ie6使用了float:属性后,margin的值为双倍距离解决办法
- IE6浮动元素的双倍边距问题
- IE6下margin双倍的问题解决办法
- 解决IE6浮动元素产生的“双边距”BUG问题及解决办法
- margin在IE6碰到float时会距离会加倍的问题解决
- ie6的设置外边距margin变双倍的问题
- IE6关于浮动、margin-bottom的兼容问题
- IE6双倍margin问题(转)