首页 > 其他 > 详细

jq实现超级简单的隔行变色

时间:2019-10-30 00:10:26      阅读:74      评论:0      收藏:0      [点我收藏+]

文章地址:https://www.cnblogs.com/sandraryan/

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    p{
        margin: 0;
        line-height: 26px;
    }
    </style>
</head>
<body>
    <p>this is a sentence.</p>
    <p>this is a sentence.</p>
    <p>this is a sentence.</p>
    <p>this is a sentence.</p>
    <p>this is a sentence.</p>
    <p>this is a sentence.</p>
    <p>this is a sentence.</p>
    <p>this is a sentence.</p>
    <p>this is a sentence.</p>

    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <script>
        // p中的奇数行偶数行设置不同的颜色
        $("p:odd").css("backgroundColor","white");
        $("p:even").css("backgroundColor","lightblue");

    </script>
</body>
</html>

jq实现超级简单的隔行变色

原文:https://www.cnblogs.com/sandraryan/p/11762059.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!