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配合使用不然不起作用。
优势就是可以把样式写在样式文件中。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。