本文主要包含IE,CSS,Bug等相关知识,佚名 希望在学习及工作中可以帮助到您
当然,还有性能问题。不过,今天要说的是样式的兼容问题。在IE/Mozilla/Webkit/Opera四分天下的今天,IE6-9/Mozilla(Gecko)系列/Chrome/Safari/Opera etc. 这些浏览器的兼容,无不让前端们头痛。而在这之中,最让人头痛的当数IE,特别是IE6。搞定了IE6,基本也就能称霸半个江山了。搞定了IE,也相当于占领了7、80%的领地。你想做一个统治页面兼容的主么?反正我是想的。
问题 | 浏览器 | DEMO | 解决方法 | |
---|---|---|---|---|
Hacking Rules:
property:all-ie\9; property:gte-ie8\0;*property:lte-ie7; +property:ie7; _property:ie6; |
||||
1 | input[button | submit] 不能用 margin:0 auto; 居中 | IE8 | bug | fixed | 为input添加width |
2 | body{overflow:hidden;}没有去掉滚动条 | IE6/7 | bug | fixed | 设置html{overflow:hidden;} |
3 | hasLayout的标签拥有高度 | IE6/7 | bug | fixed | *height:0; _overflow:hidden; |
4 | form>[hasLayout]元素有margin-left时,子元素中的[input | textarea] 出现2×margin-left | IE6/7 | bug | fixed | form > [hasLayout 元素]{margin-left:宽度;} form div{*margin-left:宽度÷2;} |
5 | 当border-width有1条<边3条时被设置成dotted时,1px的边dotted显示成dashed | IE7 | bug | fixed | 不在同一个元素上使用不同宽度的 dotted |
6 | 当子元素有position:relative的时候,父元素设置overflow:[hidden|auto]相当于给子元素设置了position:visible; | IE6/7 | bug | fixed | 给父元素设置position:relative; |
7 | :hover伪类不能改变有position:absolute的子级元素的left/top值 | IE7 | bug | fixed | 把top/left的值设置成除0%外的所有百分值;或添加一个margin-[所有方向]除0外的所有值,包括0% |
8 | :focus + selector {} 选择器失效 | IE8 | bug | fixed | 在失效选择器后面添加一个空选择器, :focus{} |
9 | 列表中混乱的浮动:在list中浮动图片时,图片出现溢出正常位置;或没有list-style | IE8 | bug | fixed | 用背景图片替换list-style |
10 | th 不会自动继承上级元素的 text-align | IE8 | bug |
您可能想查找下面的文章:文章分类 |