Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css] 第136天 你有了解css计数器(序列数字字符自动递增)吗?如何通过css的content属性实现呢? #1129

Open
haizhilin2013 opened this issue Aug 29, 2019 · 1 comment
Labels
css css

Comments

@haizhilin2013
Copy link
Collaborator

第136天 你有了解css计数器(序列数字字符自动递增)吗?如何通过css的content属性实现呢?

@haizhilin2013 haizhilin2013 added the css css label Aug 29, 2019
@ajycc20
Copy link

ajycc20 commented Aug 30, 2019

counter-reset:设置计数器 counter-reset: count 0 /* 计数器从1开始 */
counter-increment: 递增数值 counter-increment: count 2 /* 用于count 每次递增2 */
eg.

<ul>
  <li>Item</li>
  <li>Item</li>
  <ul>
    <li>Item</li>
    <li>Item</li>
  </ul>
</ul>
ul {
  counter-reset: count;
}
li::before {
  counter-increment: count;
  content: counters(count, '-')'.';
}
1.Item
2.Item
    2-1.Item
    2-2.Item

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css css
Projects
None yet
Development

No branches or pull requests

2 participants