css计数器

<!DOCTYPE html>
<html>
<head>
    <title>css计数器--兼容IE8</title>
    <meta charset="utf-8"/>
    <style type="text/css">
        *{
            margin:0;
            padding:0;
        }
        ul{
            list-style: none;
            counter-reset: list;
        }
        li{
            counter-increment: item;
        }
        li:before{
            content: counter(item)".";
            display: inline-block;
        }
    </style>
</head>

<body>
<ul>
    <li>
        aaa
    </li>
    <li>
        aaa
    </li>
    <li>
        aaa
    </li>
</ul>

</body>
</html>
View Code

 

posted @ 2017-07-10 16:10  dongxiaolei  阅读(89)  评论(0编辑  收藏  举报