多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## counter-increment 属性 ### 属性定义及使用说明 counter-increment属性递增一个或多个计数器值。 counter-increment属性通常用于counter-reset属性和content属性。 JavaScript 语法:object.style.counterIncrement="subsection" ## 属性值 | 值 | 说明 | | :-- | :-- | | none | 没有计数器将递增 | | *id number* | id 定义将增加计数的选择器、id 或 class。number 定义增量。number 可以是正数、零或者负数。 | | inherit | 指定counter-increment属性的值,应该从父元素继承 | * * * ## 实例--对部分和子部分进行编号(比如 "Section 1"、"1.1"、"1.2")的方法: ``` <!DOCTYPE html> <html> <head> <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>Note:</b> IE8 supports these properties only if a !DOCTYPE is specified.</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> ```