How do I count the elements? In the early days, only OL and UL could sort on the pair element Li, while the CSS2.1 specification added a new counter attribute, with pseudo-elements: before,: After the content is used, the specified elements can be sorted.
The CSS counters include counter-reset, counter-increment, content three properties, counter () functions, and pseudo-elements: before,: After.
Syntax Description:
counter-reset: identifier [integer]
The default value is None
Indetifier: Custom counter name, required;
Integer: Counter starting value, default is 0, optional; If the setting value is 0, the count starts from 1;
Function: The scope used to identify the counter. Can contain multiple counter identifiers.
counter-increment: identifier [integer]
The default value is None
The counter identifier declared in the Indetifier:counter-reset, must be selected;
Integer: integer value, the interval of the ordinal change, positive value increment change, negative value decreases the change, also can be 0, the default is 1, optional, if the value is set to 2, and Counter-reset is set to 0 or not set integer, the element ordinal is 2, 4, 6 and so on;
Function: Used to identify the counter and its element ordinal change rules.
counter (): Use with content, accept two parameters, separated by commas.
First parameter: Counter identifier defined in Counter-increment
Second parameter: Counter style, similar to List-style-type
CSS Counter: Counter