Last active
August 29, 2015 14:05
-
-
Save mishelen/d1aa4429c0acb6d18b39 to your computer and use it in GitHub Desktop.
Счетчик средствами CSS, взамен мало кастомизируемого <ol>.
From https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Counters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Один счетчик поуровнево, разделитель второй аргумент*/ | |
| ol { | |
| counter-reset: item; | |
| list-style: none; | |
| } | |
| li { | |
| display: block; | |
| } | |
| li:before { | |
| counter-increment: item; | |
| content: counters(item, ".") " "; | |
| } | |
| /*это с определением стиля счета*/ | |
| li:before { | |
| counter-increment: item; | |
| content: counters(item, ".", lower-roman) " "; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| counter-reset: section; /* Set the section counter to 0 */ | |
| } | |
| h3:before { | |
| counter-increment: section; /* Increment the section counter */ | |
| content: "Section " counter(section) ": "; /* Display the counter */ | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dl { | |
| counter-reset: term -1; | |
| } | |
| dt:before { | |
| counter-increment: term 3; | |
| content: counter(term) ". "; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*сквозная нумерация для второго уровня*/ | |
| dl { | |
| counter-reset: term definition; | |
| } | |
| dt:before { | |
| counter-increment: term; | |
| content: counter(term) ". "; | |
| } | |
| dd:before { | |
| counter-increment: definition; | |
| content: counter(term) "." counter(definition) " "; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment