欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!
  说明
 
  利用这个属性,计数器可以递增(或递减)某个值,这可以是正值或负值。如果没有提供number值,则默认为1。
 
  注释:如果使用了"display:none",则无法增加计数。如使用"visibility:hidden",则可增加计数。
 
  值 描述
 
  none
 
  默认。选择器无计数器增量。
 
  idnumber
 
  id定义将增加计数的选择器、id或class。
 
  number定义增量。number可以是正数、零或者负数。
 
  inherit
 
  规定应该从父元素继承counter-increment属性的值。
 
  实例
 
  对部分和子部分进行编号(比如"Section1"、"1.1"、"1.2")的方法:
 
  
 
  
 
  <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
  <html>
 
  <head>
 
  <styletype="text/css">
 
  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,那么InternetExplorer8(以及更高版本)支持counter-increment属性。</p>
 
  <h1>HTMLtutorials</h1>
 
  <h2>HTMLTutorial</h2>
 
  <h2>XHTMLTutorial</h2>
 
  <h2>CSSTutorial</h2>
 
  <h1>Scriptingtutorials</h1>
 
  <h2>JavaScript</h2>
 
  <h2>VBScript</h2>
 
  <h1>XMLtutorials</h1>
 
  <h2>XML</h2>
 
  <h2>XSL</h2>
 
  </body>
 
  </html>






本文转载自中文网


 

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c55993.shtml