Skip to content

Instantly share code, notes, and snippets.

@mishelen
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save mishelen/d1aa4429c0acb6d18b39 to your computer and use it in GitHub Desktop.

Select an option

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
/*Один счетчик поуровнево, разделитель второй аргумент*/
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) " ";
}
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 */
}
dl {
counter-reset: term -1;
}
dt:before {
counter-increment: term 3;
content: counter(term) ". ";
}
/*сквозная нумерация для второго уровня*/
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