css table之合并单元格

colspan 是合并列,rowspan是合并行,合并行的时候,比如rowspan="2",它的下一行tr会少一列;合并列的时候 colspan="2",此行的列会少一列

    <table border="1" style={{margin:200}}>
      <tbody>
        <tr>
          <th colspan="2">我是占位符</th>
          <th colspan="2">我是占位符</th>
        </tr>
        <tr>
          <th rowspan="2">我是占位符</th>
          <th>我是占位符</th>
          <th>我是占位符</th>
          <th>我是占位符</th>
        </tr>
        <tr>
          <th>我是占位符</th>
          <th>我是占位符</th>
          <th>我是占位符</th>
        </tr>
      </tbody>
    </table>

效果图:

猜你喜欢

转载自blog.csdn.net/qq_36826506/article/details/81227538
今日推荐