当前位置: 首页 > 网络学院 > 网页制作基础教程 > CSS > CSS counter-reset属性

CSS
CSS 介绍
CSS 语法
使用 CSS
CSS 背景
CSS 文字
CSS 字体
CSS 边框
CSS 边距
CSS 填充
CSS 列表
CSS 尺寸
CSS 类别
CSS 定位
CSS 伪类
CSS 伪元素
CSS2 Media类型
CSS 摘要
CSS 实例
CSS2 参考资料
CSS2 打印

CSS counter-reset属性


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 259 ::
收藏到网摘: n/a

The counter-reset property sets the value the counter is set to on each occurrence of a selector. Default is 0.
counter-reset 属性可将指定选择符(selector)的计数器复位。默认值为0

Note: If "display: none" is used you should not be able to reset the counter. If "visibility: hidden" is used you should be able to reset the counter.
注意:如果使用了"display:none"那么就能够增加记数器了。如果使用的是 "visibility: hidden"那么记数器还是能够增加的。

Inherited: No
继承性:无

举例

A way to number sections and sub-sections with "Section 1", "1.1", "1.2", etc.

h1:before
{
content: "Section " counter(section) ". ";
/* Add 1 to section */
counter-increment: section;
/* Set sub-section to 0 */
counter-reset: sub-section;
}

h2:before 
{
content: counter(section) "." counter(sub-section) " ";
counter-increment: sub-section;
}

可用值

描述 NN IE
none No reset of the counter in the selector
阻止计数器复位
   
identifier number The identifier defines a selector, id, or class that should reset the counter. The number sets the value the counter is set to on each occurrence of the selector. number can be a positive number,zero, or a negative number
identifier 定义一个将被复位的选择符(selector),id,或者class。 number 定义复位的数值。可以为负值。默认值是 0
   

评论 (0) All

登陆 | 还没注册?