HTML and CSS Reference
In-Depth Information
CSS counters provide the ability to create and use a count of elements of
a selected type in a document. Though it would be most useful to aid in
customizing item markers, counters aren't limited to lists and can help
with document outline style presentations or other embellishments.
counter-increment
The previous specifies that the counter with a provided text label
(
<identifier>
) should be incremented when the element defined
by the selector is encountered in the document.
■
<identifier>
: The counter to be incremented by
1
■
<identifier>
<integer>
: The counter to be incremented and a value
(positive or negative) for each step
counter()
Inside the
content
property, the current value of a given counter can be
accessed with the
counter()
function:
■
counter(<indentifier>)
: Returns the value of the specified counter
■
counter(<identifier>
<list-style-type>)
: Returns the value of the
specified counter formatted to fit the provided
list-style-type
value
(
decimal
,
upper-roman
, and so on)
counter-reset
■
<identifier>
: Resets the specified counter to 0
■
<identifier>
<integer>
: Resets the specified counter to some
integer value