Skip to content Skip to sidebar Skip to footer

How To Add Vertical Header To The Table

I am trying to add one full width table header vertically, on the left side of the table as shown in image. But, I could not get how to do that. So far, I could find only to add t

Solution 1:

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<table class="table">
  <thead>
    <tr>
      <th colspan="4" style="text-align:center">
        Horizontal Header
      </th>
    </tr>
    <tr>
      <th scope="col"></th>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th rowspan="3"><span style="    position: absolute;
transform: rotate(-90deg);
top: 159px;
left: -22px;">Vertical Header</span></th>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Post a Comment for "How To Add Vertical Header To The Table"