HTML and JavaScript auto increment number

前端 未结 6 1878
逝去的感伤
逝去的感伤 2020-12-30 17:04

I am new to HTML and JavaScript. I got a problem like this in HTML (This code below only visualize the problem for you to easy to reference.)


             


        
6条回答
  •  余生分开走
    2020-12-30 17:38

    You can use a css counter - MDN

    table {
      counter-reset: section;
    }
    
    .count:before {
      counter-increment: section;
      content: counter(section);
    }
    Harry
    Simon
    Maria
    Victory

    FIDDLE

提交回复
热议问题