这篇文章给大家分享了多个关于IE6下兼容性的常见问题,有需要的朋友们下面来一起学习学习吧。
常见问题一:在Ie6下,内容会把父元素设置好的宽高撑开。计算一定要精确
.box{width:400px;}.left{width:200px;height:210px;background:red;float:left}.right{width:200px;float:right;overflow:hidden;}.div{width:180px;height:180px;background:blue;padding:25px;} |
<div class="box"> <div class="left"></div> <div class="right"> <div class="div"></div> </div></div> |
常见问题二:在IE6元素浮动,如果宽度需要内容撑开,里面块级元素的内容也要加浮动
.box{width:400px;}.left{background:red;float:left;}.right{background:blue;float:right;}h3{height:30px;float:left;} |
<div class="box"> <div class="left"> <h3>左侧</h3> </div> <div class="right"> <h3>右侧</h3> </div></div> |
常见问题三:p里面不要套用p标签或者标题标签
常见问题四:IE6下最小高度问题
当height<19px的时候会被当作19px来处理
解决办法:overflow:hidden
.box{height:2px;background:red;overflow:hidden}<div class="box"></div> |
常见问题五:border:1px dotted; IE6不支持
解决办法:切背景平铺
.box{width:100px;height:100px;border:1px dotted red;margin:100px auto;} <div class="box"></div> |
常见问题六:IE6下,父元素用边框,子元素的margin会消失
解决办法:触发父元素的haslayout;
.box{background:red;border:1px solid red;zoom:1;/*padding:1px;*/}.div{width:200px;height:200px;background:blue;margin:100px} |