临时:counter-reset

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>css counter</title>
    <style>
        body {
            counter-reset: firstName;
        }

        h2{
            list-style: none;
            counter-reset: twoName;
        }

        h2:before {
            counter-increment: firstName;
            // content:"";
            content: "Section " counter(firstName) ". ";
        }

        li:before {
            counter-increment: twoName;
            content: counter(firstName) "." counter(twoName) " ";
        }
        li{
            list-style: none;
        }
    </style>
</head>
<body>
    <h2>圣诞节系列</h2>
    <ul>
        <li>麋鹿</li>
        <li>平安夜</li>
        <li>圣诞老人</li>
    </ul>
    <h2>元旦系列</h2>
    <ul>
        <li>跨年</li>
        <li>放假咯</li>
        <li>吃火锅</li>
    </ul>
</body>
</html>

猜你喜欢

转载自www.cnblogs.com/gushixianqiancheng/p/12389733.html