CSS Counter: Counter

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.