我想通過CSS添加一個增量值,但顯然我做錯了什麼。用CSS計數器添加一個自動增量值
HTML
<ul role="menu" style="left: 0px; position: absolute; top: 0px;">
<li id="Slideshow-13675338798500">
<a class="slideshow-thumbnails-hidden" href="images/slideshow/slide-1.png" role="menuitem" tabindex="0">
<span class="thmubbutton"></span>
</a>
</li>
<li id="Slideshow-13675338798501">
<a class="slideshow-thumbnails-hidden" href="images/slideshow/slide-2.png" role="menuitem" tabindex="1">
<span class="thmubbutton"></span>
</a>
</li>
<li id="Slideshow-13675338798502">
<a class="slideshow-thumbnails-hidden" href="images/slideshow/slide-3.png" role="menuitem" tabindex="2">
<span class="thmubbutton"></span>
</a>
</li>
</ul>
CSS
span.thmubbutton{
counter-increment: myIndex;
}
span.thmubbutton:before
{
content:counter(myIndex);
}
輸出是1 | 1 | 1
http://caniuse.com/css-counters – user1311784 2013-05-02 22:53:07