html merge table cells code example

Example 1: concatenate cells in table html

<table>
  <tr>
    <th> Name </th>
    <th> Qty </th>
    <th> Unit Price </th>
    <th> Cost </th>
  </tr>
  <tr>
    <td> Pencil </td>
    <td> 2 </td>
    <td> 2.50 </td>
    <td> 5.00 </td>
  </tr>
  <tr>
    <td> Handle </td>
    <td> 4 </td>
    <td> 3.50 </td>
    <td> 14.00 </td>
  </tr>
  <tr>
    <td colspan = "3"> Total </td>
    <td> 19.00 </td>
  </tr>
</table>

Example 2: bootstrap table combine columns

<thead>
  <tr>
    <th rowspan="2">State</th>
    <th rowspan="2">Utilities Company</th>
    <th colspan="3">Summer Period</th>
  </tr>
  <tr>
    <th>data1</th>
    <th>data2</th>
    <th>data3</th>
  </tr>
</thead>

Tags:

Html Example