css3計時器,根據(jù)個數(shù)自動增加。就不需要浪費一張圖片資源了。
在此記下,方便后期翻閱
counter-increment屬性遞增一個或多個計數(shù)器值。
counter-increment屬性通常用于counter-reset屬性和content屬性。
可能出現(xiàn)的值:
none:沒有計數(shù)器將遞增
id number:id 定義將增加計數(shù)的選擇器、id 或 class。number 定義增量。number 可以是正數(shù)、零或者負數(shù)。
inherit:指定counter-increment屬性的值,應(yīng)該從父元素繼承
用法:
<style type="text/css">
ol {
counter-reset: section; /* 為每個ol元素創(chuàng)建新的計數(shù)器實例 */
list-style-type: none;
}
li:before {
counter-increment: section; /* 只增加計數(shù)器的當(dāng)前實例 */
content: counters(section, ".") " "; /* 為所有計數(shù)器實例增加以“.”分隔的值 */
}
</style>
<ol>
<li>a</li>
<li>b</li>
<li>c</li>
</ol>

實現(xiàn)的效果