html - 将 ol 列表编号排列到左侧

标签 html css html-lists

是否可以将 ol 列表编号(2 位数字)排列为从左侧开始。

通常是这样的

1
2
.
.
10
12

但我需要这样显示

enter image description here

最佳答案

也许您可以使用计数器增量来实现这一点。像这样写:

ul{    counter-reset: chapter 0;  }
li:before{    
    counter-increment: chapter;    
    content:counter(chapter) ". ";
    width:20px;
    display: inline-block;
    text-align: right;   
}  

检查这个http://jsfiddle.net/upc6b/

关于html - 将 ol 列表编号排列到左侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12635206/

相关文章:

javascript - 如何在提交按钮上显示 loading.gif 并在加载后隐藏?

jquery - 为什么 jquery/css 需要 'px' 作为 top 属性,而不是 width 或 height 属性?

css - ul li 的 css 悬停颜色冲突

html - 在<ol>内的<a>标签上设置 "display: list-item"是否有效?

html - CSS - 带向下箭头的按钮,需要它指向上方 :hover

javascript - 如何在 React 中引用 index.html 中的 css 文件

html - 填充在绝对 div 父 bootstrap 4 中不起作用

javascript - 如何用 JavaScript 中的 DOM 操作函数替换元素内容?

html - FancyBox 填充(顶部和底部)

html - 在本地存储中存储列表