html - 列表的 Css 计数器

标签 html css

我正在尝试在我的有序列表中使用 css 中的计数器增量,但它不起作用

这是我要显示的内容:

1. Acknowledgements
   1.1 blah, blah ....
   1.2 blah, blah ....
   1.3 blah, blah ....

2. Risk Statement
   2.1 blah, blah ....
   2.2 blah, blah ....
   2.3 blah, blah ....

3. License
   3.1 blah, blah ....
   3.2 blah, blah ....
   3.3 blah, blah ....

但这就是正在发生的事情... http://jsfiddle.net/XQKcy/

最佳答案

Demo Fiddle

你们非常亲密:

body {
    counter-reset: listCounter;
}
ol {
    counter-increment: listCounter;
    counter-reset: itemCounter;
    list-style:none;
}
li{
    counter-increment: itemCounter;
}
li:before {
    content: counter(listCounter) "." counter(itemCounter);
    left:10px;
    position:absolute;
}

关于html - 列表的 Css 计数器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23267039/

相关文章:

javascript - IE6 上的 removeAttr/addClass 问题

javascript - jQuery 和 CSS 问题 - 动画

html - CSS:悬停时更改颜色

php - 使用循环在php页面中显示html复选框多个复选框内容

javascript - 如何隐藏默认样式滚动条,当我使用 overflow :scroll;

jquery - 在字段选择上克隆 HTML 字段

css - 更改 jQueryUI 对话框关闭 X 的颜色

html - CSS:沿div底部对齐图像

html - 在卡住 gridview 中的标题期间正确设置标题宽度和列

javascript - 更改 <select> onclick 的内容