css - 如何使用格式为 "number: 1, 2, 3, 4, 5"的样式表?

标签 css

<ul>
    <li>number</li> 
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
</ul>

和样式表:

ul {
    list-style-type: none
}

ul li {
    float: left;
}

li:after {
    content: ", "
}

li:before {
    content: ": "
}

li:last-child:after {
    content: "."
}

li:first-child:before {
    content: ""
}

结果是:

number, 1, 2, 3, 4, 5.

如何修正这个结果:

number: 1, 2, 3, 4, 5.

最佳答案

添加这个:

li:first-child:after {
    content: ": "
}

关于css - 如何使用格式为 "number: 1, 2, 3, 4, 5"的样式表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14599671/

相关文章:

java - 向组件 Vaadin 添加属性

CSS :not() selector not working as expected (nested)

css - 如何设置 formtastic 单选按钮的样式

css - 我不明白为什么我的下拉菜单没有隐藏

html - 防止 HTML 表格溢出包含的 div

css - Angular Material cdk-container 和主站点固定标题 z-index 覆盖

html - 个人资料图片显示

javascript - 如何给div添加上下滑动效果?

javascript - 背景大小 :cover makes background image full-size instead of fitting to div

jquery - 下拉 onchange 显示或隐藏 div 不起作用