JSFiddle - React, Tailwind, and code Playground

by aaronj1335

HTML

<div class=container>
  <div class=widget>
    <table>
      <thead>
        <tr>
          <th>
            <span class=resize>&nbsp;</span>
            header 1
          </th>
          <th>
            <span class=resize>&nbsp;</span>
            header 2
          </th>
          <th>
            <span class=resize>&nbsp;</span>
            header 3
          </th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>row 1 col 1</td>
          <td>row 1 col 2</td>
          <td>row 1 col 3</td>
        </tr>
        <tr>
          <td>row 2 col 1</td>
          <td>row 2 col 2</td>
          <td>row 2 col 3</td>
        </tr>
        <tr>
          <td>row 3 col 1</td>
          <td>row 3 col 2</td>
          <td>row 3 col 3</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>

CSS

div.container {
    padding: 8px;
    border: 1px solid black;
    padding: 8px;
}

div.widget {
    margin: 4px;
    border: 1px solid gray;
    border-left: 3px solid blue;
}

table {
    width: 100%;
}

td, th {
    padding: 4px;
}

th {
    position: relative;
    white-space: nowrap;
    text-overflow: ellipsis;
}

th .resize {
    right: -4px;
    top: 0;
    bottom: 0;
    width: 8px;
    background-color: gray;
    cursor: col-resize;
    position: absolute;
}

th:after {
    content: ' ';
    display:block;
    background-color: gray;
    height: 2px;
    margin: 0 8px 5px -3px;
}