码迷,mamicode.com
首页 > 其他好文 > 详细

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

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

标签:lin   css   颜色   view   简单的   blank   title   span   round   

文章地址: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实现超级简单的隔行变色

标签:lin   css   颜色   view   简单的   blank   title   span   round   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!