html,一列自动增量编号

SAR*_*SAR 3 html

   <table>
        <tr>
          <td>Num</td>
          <td>Name</td>
        </tr>
       <? foreach {{ ?>
        <tr>
           <td>here this must be html auto increment number</td>
           <td>this will be from database</td>
        <tr>
       <? endforeach; ?>
   </table>
Run Code Online (Sandbox Code Playgroud)

<td>Num</td>应自动递增页面上的号码.是否可以在没有任何JavaScript或其他简单解决方案的HTML中执行此操作?

Hid*_*bes 5

您可以尝试使用counter-increment:

table {
    counter-reset: tableCount;     
}
.counterCell:before {              
    content: counter(tableCount); 
    counter-increment: tableCount; 
}
Run Code Online (Sandbox Code Playgroud)
<table>
  <tr>
    <td>Num</td>
    <td>Name</td>
  </tr>
  <tr>
    <td class="counterCell"></td>
    <td>this will be from database</td>
  </tr>
  <tr>
    <td class="counterCell"></td>
    <td>this will be from database</td>
  </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

对此的支持似乎相当不错:http://caniuse.com/#feat=css-counters