Агуулга
- Pizza
- Hamburger
- Hotdogs
- Automatic Numbering With Counters
- element and adds "Section :" to the beginning of each element: body { counter-reset: section; } h2::before { counter-increment: section; content: "Section " counter(section) ": "; } Nesting Counters
- element with ".": body { counter-reset: section; } h1 { counter-reset: subsection; } h1::before { counter-increment: section; content: "Section " counter(section) ". "; } h2::before { counter-increment: subsection; content: counter(section) "." counter(subsection) " "; } A counter can also be useful to make outlined lists because a new instance of a counter is automatically created in child elements. Here we use the counters() function to insert a string between different levels of nested counters: ol { counter-reset: section; list-style-type: none; } li::before { counter-increment: section; content: counters(section,".") " "; } CSS Counter Properties