详解: 8,连续和不连续最后与开始的选择器

核心:我不说之前说过的话,+nth代表从1开始,是奇数还是偶数哈

```css
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        .test1 p:first-of-type
        {
            color: red;
        }
        .test1 p:nth-of-type(1)
        {
            color: blue;
        }
        .test1 p:last-of-type
        {
            color: yellow;
        }
    .test1 p:nth-last-of-type(1)
    {
        font-size: 10px;
    }
    </style>
</head>
<body>
    <div class="test1">
        <h1>1111</h1>
        <h2>333</h2>
        <p>444</p>
        <p>555</p>
        <h3>66666</h3>
        <h3>777770</h3>
        <p>8888</p>
        <h3>6666</h3>
    </div>7
</body>
</html>

posted @ 2020-04-25 01:25  贵哥的编程之路  阅读(6)  评论(0)    收藏  举报