Skip to content

Instantly share code, notes, and snippets.

@may88seiji
Created September 28, 2017 09:43
Show Gist options
  • Save may88seiji/7aba03513e339b38c0d02f3f6103d7dc to your computer and use it in GitHub Desktop.
Save may88seiji/7aba03513e339b38c0d02f3f6103d7dc to your computer and use it in GitHub Desktop.
counterを利用した自動ナンバリング http://design-studio-f.com/blog/css-counter-automatic-numbering/
body {
counter-reset: number 0; /* number のカウンタを 0 にセット */
}
h1:before {
counter-increment: number 1; /* number カウンタの増加数をセット */
content: counter(number) " "; /* 表示形式を指定 */
}
ol {
counter-reset: item;
list-style-type: none;
}
li { display: block; }
li:before {
content: counter(item, decimal-leading-zero) " ";
counter-increment: item;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment