html - 列出样式 css,在列表中获取 a) 而不是 a

标签 html css

为什么要创建有序列表来显示 a) 而不是 a。当使用带有 ul/li 标签的 css 时

目前我有这种风格 ol.lower-alpha {list-style-type:lower-alpha} 产生一个。而不是一个)

例如。

我需要它看起来像这样

 a) item 1
 b) item 2

最佳答案

是的,使用计数器(它有很好的支持,但仍然有限,所以要小心)。示例 ( jsfiddle ):

ol {
   list-style-type: none;
   counter-reset: list;
}
ol li:before {
    content: counter(list, lower-alpha) ") ";
    counter-increment: list;
}

关于html - 列出样式 css,在列表中获取 a) 而不是 a,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8969067/

相关文章:

javascript - 隐藏一个 Div 并在单击时显示一个新的 Div

jquery - 将模态图像居中 : which <div> to style?

html - 我怎样才能让我的菜单栏居中?

javascript - 如何将 css 样式表和 js 文件调用到自定义 WordPress 主题中

javascript - 如何配置此选项卡 slider

javascript - 从链接中删除点击事件并恢复默认行为

html - 两个 td 或 tr 标签之间的空格

html - 自动填充用户名/密码时如何防止 Chrome 更改字体?

c# - HtmlAgilityPack 读取 html 时出现问题

html - 字体不能在外部工作