让IE8兼容识别css3选择器——selectivizr-min.js

html:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link type="text/css" rel="stylesheet" href="css.css" />
<script type="text/javascript" src="jquery-1.8.3.min.js"></script>
<!--[if (gte IE 6)&(lte IE 8)]>
<script src="selectivizr-min.js"></script>
<![endif]-->
</head>
<body>
<div id="xx">
<p haha="tit">第一</p>
<p haha="tit">第二</p>
<p><input type="text" placeholder="sdf"></p>
</div>
</body>
</html>
css:
//css.css *{margin: 0;padding: 0;} p:nth-child(2){background: #ccc;color: red;} p:last-child{background: yellow;color: red;} p:last-child input:focus{background: green;color: #fff;} p:first-child{background: pink;color: red;}
经过测试也并没有像作者说的那样兼容这么多选择器,但是常用的还是兼容的。使用时基本和jquery配合使用不然不起作用。
优势就是可以把样式写在样式文件中。

浙公网安备 33010602011771号