小白教程
所有教程
关于
Search
172.70.131.173
172.70.131.173
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Pr gen counter reset”的源代码
本页内容
上一节:
Pr_gen_counter_increment
下一节:
Pr_gen_quotes
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:counter-reset}}[[Category:css reference|132]] = CSS counter-reset 属性 = 对部分和子部分进行编号(比如 "Section 1"、"1.1"、"1.2")的方法: <sample title="" desc="" lang="html" hererun="1"> body { counter-reset:section; } h1 { counter-reset:subsection; } h1:before { counter-increment:section; content:"Section " counter(section) ". "; } h2:before { counter-increment:subsection; content:counter(section) "." counter(subsection) " "; } </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <style> body {counter-reset:section;} h1 {counter-reset:subsection;} h1:before { counter-increment:section; content:"Section " counter(section) ". "; } h2:before { counter-increment:subsection; content:counter(section) "." counter(subsection) " "; } </style> </head> <body> <p><b>注意:</b> 仅当 !DOCTYPE已经定义 IE8支持 这个属性.</p> <h1>HTML tutorials</h1> <h2>HTML Tutorial</h2> <h2>XHTML Tutorial</h2> <h2>CSS Tutorial</h2> <h1>Scripting tutorials</h1> <h2>JavaScript</h2> <h2>VBScript</h2> <h1>XML tutorials</h1> <h2>XML</h2> <h2>XSL</h2> </body> </html> </run> == 属性定义及使用说明 == counter-reset属性创建或重置一个或多个计数器。 counter-reset属性通常是和counter-increment属性,content属性一起使用。 {| class="table table-striped table-hover" | 默认值: | none |- | 继承: | no |- | 版本: | CSS2 |- | JavaScript 语法: | object.style.counterReset="subsection" |} == 浏览器支持 == 所有主流浏览器都支持counter-reset属性。 '''注意:''' IE8只有指定!DOCTYPE才支持counter-reset属性。 == 属性值 == {| class="table table-striped table-hover" ! 值 ! 说明 |- | none | 默认。不能对选择器的计数器进行重置 |- | id number | id 定义重置计数器的选择器、id 或 class。 number 可设置此选择器出现次数的计数器的值。可以是正数、零或负数。 |- | inherit | 规定应该从父元素继承 counter-reset 属性的值 |} == 相关文章 == CSS reference: [[sel before|:before 伪元素]] CSS reference: [[sel after|:after 伪元素]] CSS reference: [[pr gen content|content 属性]] CSS reference: [[pr gen counter increment|counter-increment 属性]]
返回至“
Pr gen counter reset
”。
上一节:
Pr_gen_counter_increment
下一节:
Pr_gen_quotes