JSFiddle - React, Tailwind, and code Playground

by TheDiamondDoge

HTML

<div class="out">
  <div class="container">
    <table>
      <thead>
        <tr>
          <th class="absolute">Header 1Header 1Header 1Header 1Header 1</th>
          <th class="absolute_second">Header 2</th>
          <th>Header 1Header 1Header 1Header 1Header 1Header 1Header 1Header 1</th>
          <th>Header 2</th>
          <th>Header 1</th>
          <th>Header 2</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td class="absolute">Body 1</td>
          <td class="absolute_second">Body 2</td>
          <td>Body 1</td>
          <td>Body 2</td>
          <td>Body 1</td>
          <td>Body 2</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>

CSS

.out {
   position: relative;
   /* margin-left: 100px; */
}

td {
  width: 50px;
}

table {
  margin-left: 100px;
}

.container {
/*   margin-left: 50px; */
  width: 200px;
  overflow: auto;
}

.absolute {
  position: absolute;
  left: 0;
  width: 50px;
  background-color: white;
  /* border-right: black solid 1px; */
}

.absolute_second {
  position: absolute;
  left: 50px;
  width: 50px;
  background-color: white;
  border-right: black solid 1px;
}