让IE88兼容识别css3选择器——selectivizr-min.js 随笔

 

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

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配合使用不然不起作用。

优势就是可以把样式写在样式文件中。

selectivizr-1.0.2

http://selectivizr.com/

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄