详解: 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>

原创文章 107 获赞 14 访问量 1370

猜你喜欢

转载自blog.csdn.net/qq_37805832/article/details/105743661