【问题标题】:CSS Content: Adding a style/classCSS 内容:添加样式/类
【发布时间】:2015-01-11 16:58:09
【问题描述】:
ol:before {
  counter-increment: section;
  content: "Article " counter(section) ". ";
 }

如何向内容添加类:? 如果那不可能,那么样式也可以

由于您要插入内容,我希望它们隐藏。如果我删除整行,它将不计算在内

目前显示如下:

Article 1: Terms of Condition

Article 1:
1.1 lorem ipsum
1.2 lorem ipsum
1.3 lorem ipsum

第二条“第1条”应该隐藏

【问题讨论】:

  • 请注意,我不想在行尾添加“条件条款”,因为对于其他文章,它会显示相同的名称

标签: css html-lists css-content


【解决方案1】:

改为向ol 元素添加一个类:

<ol class="... before-class">

然后使用 :before 伪元素设置样式:

ol.before-class:before {
    display: none;
}

【讨论】:

  • visibility: hidden 对我来说效果更好,不知道为什么,但现在可以了。谢谢詹姆斯
猜你喜欢
  • 1970-01-01
  • 2014-07-05
  • 1970-01-01
  • 2012-11-02
  • 1970-01-01
  • 2011-06-23
  • 1970-01-01
  • 2022-10-14
  • 2011-04-28
相关资源
最近更新 更多