在分页媒体中,CSS 属性target-counters http://www.w3.org/TR/css3-gcpm/#the-target-counter-and-target-counters-v可用于包含多个计数器。该规范给出了以下示例(简化):
a::after {
content: "see section " target-counters(attr(href, url), section, ".")
}
应该输出类似的东西(see section 1.3.5)
.
我将如何设置section
柜台?
来自生成内容模块 http://www.w3.org/TR/css3-content/#nested(也适用于非分页内容):
计数器是“自嵌套”的,从某种意义上说,在程序中重复使用计数器
子元素自动创建计数器的新实例。
因此,你可以写
<style type="text/css">
section {counter-increment: section;}
</style>
<section id="foo">
<h1>Root level</h1>
<section id="bar">
<h2>Sub Level</h2>
</section>
</section>
如果您的元素树是扁平的(如<h1>Root</h1><h2>Sub</h2>
).
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)