通常情况下,一些主流浏览器都兼容background、position等元素;但是,IE6不支持background、position等;以下,我为大家讲解IE6的兼容问题
background,IE6、7的兼容方法
#menu ul li a .current{
background:#ccc;
_background:#ccc; /*IE 6*/
*background:#ccc; /*IE 7*/
}
/* IE 6 hack */
*html #menu ul li a .current{
background:#ccc;
}
方法:hack,通过编码实现不同浏览器,设置不同的样式
/* IE 6 hack */
* html, * html body {
background-image: url(about:blank);
background-attachment: fixed;
}
* html #menu {
position: absolute;
bottom: auto;
top: expression(100+((e=document.documentElement.scrollTop)?e:document.body.scrollTop)+'px');
}