Counter properties of CSS Learning

Source: Internet
Author: User

Learn CSS, the Counter property has to be understood clearly that CSS counter properties are supported by almost all browsers (including IE8), but are not often used. This article and everyone to share is counter property related content, although this property is not commonly used, but I hope you need to use the time, this article is helpful to everyone.
Counter-reset
Translate to counter reset. Shaped like: Counter-reset:counter-name
The common wording is
/ * Set counter-name to 0 * /
Counter-reset:counter-name;
/ * Set counter-name to-1 * /
counter-reset:counter-name-1;
/ * Set counter1 to 1, and counter2 to 4 * /
Counter-reset:counter1 1 counter2 4;
used to reset counter on an element
counter-increment
couter-increment Translate to counter reset
commonly used in the wording
/ * Increment counter-name by 1 */counter-increment:counter-name;
/ * Decrement counter-name by 1 */counter-increment:counter-name-1;
/ * Increment counter1 by 1, and decrement counter2 by 4 */counter-increment:counter 1 counter2-4;
before using counter-increment, we must first initialize a counter with Counter-reset in its parent element .
For example:
//parent element has a counter-reset//applied to instantiate itsection {
Counter-reset:unicorncounter;
}
//Specify the child element being countedsection H1 {
Counter-increment:unicorncounter;
}
in the above code, each H1 element of the section will be set counted value of 1
CSS Grammar rules
Counter-reset and counter-increment are similar in syntax
The first digit indicates the specific counter identification
can be a-Z 0-9 _-combination of words but cannot be keyword none, unset, initial, or inherit


Source: Network

Counter properties of CSS Learning

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.