存档
虽然用各种CSS Hack,使我们的页面能在不同的浏览器中表现出相同的效果,但是CSS2.1的选择器却没有在IE6中正常解释的解决方案,放弃CSS2.1?写两个CSS,一个有CSS2.1选择器的IE7,FF等浏览器,然后再写一个IE6的CSS?
我相信做网站前断的都遇到这个问题把,难道就没有解决方案了吗?放弃CSS2.1?写两个CSS?
这几天在CSDN上发现了一个好东东,通过在IE6上执行JS脚本,来解析CSS2.1的选择器,而且屡试不爽,分享给大家。
脚本下载:http://www.miaoqiyuan.cn/js/iehack.js
下面是写得一个DEMO
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<title>JsHack DEMO</title>
<!–[if lte IE 6]><script type="text/javascript" src="http://www.miaoqiyuan.cn/js/iehack.js"></script>< ![endif]–>
<style type="text/css">
.test>strong{color:#6699FF}
.test>div>strong{color:#FF0000}
</style>
</head>
<body>
<div class="test">
<strong>0000000000</strong>
<div>
<strong>1111111111</strong>
<div>
<strong>22222222222</strong>
<div>
[...]