Search code examples
csshtml-listscss-content

CSS Content: Adding a style/class


ol:before {
  counter-increment: section;
  content: "Article " counter(section) ". ";
 }

How do i add a class to content:? if thats not possible a style will also do

Since you're inserting content, i want them to hide. If i remove the whole line it will not count

Currently it shows up like this:

Article 1: Terms of Condition

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

The 2nd "Article 1" should hide


Solution

  • Add a class to the ol element instead:

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

    Then style the :before pseudo-element using that:

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