我遇到了 CSS 计数器的问题。
我设置了两个计数器:一个索引headings
和其他索引images
。但是,只有一个工作正常,另一个(用于图像)在所有图像描述中仅显示数字 1。您可以在此处查看示例
body {
counter-reset: figcounter;
counter-reset: head2counter;
}
.fig:before {
counter-increment: figcounter;
content: "Fig. " counter(figcounter)": ";
font-weight: bold;
}
.figreset {
counter-reset: figcounter;
}
.head2:before {
counter-increment: head2counter;
content: counter(head2counter)" ";
}
.head2reset {
counter-reset: head2counter;
}
<h1>Article title</h1>
<h2 class="head2">Services</h2>
<img src="http://www.google.com/about/company/images/company-products.png" width="200" />
<span class="fig">Google services</span>
<h2 class="head2">E-mail clients</h2>
<h2 class="head2">Others</h2>
<img src="http://4.bp.blogspot.com/-JOqxgp-ZWe0/U3BtyEQlEiI/AAAAAAAAOfg/Doq6Q2MwIKA/s1600/google-logo-874x288.png" width="200" />
<span class="fig">Google logo</span>
<br />
<img src="http://thenextweb.com/wp-content/blogs.dir/1/files/2013/02/google_chrome.png" width="200" />
<span class="fig">Chrome</span>
你知道如何解决吗?如果只有一个计数器,它可以正常工作。我想在headings
.