Dev Helpers
← Back

Let columns size from the declared table width

Let columns size from the declared table width with native CSS. The preview includes a small shared demo stylesheet.

Open this example in the interactive library

Source code

<style>
  .demo {
    width: 100%;
    table-layout: fixed;
  }
  .demo td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
</style>
<table class="demo">
  <caption>
    Fixed layout
  </caption>
  <tbody>
    <tr>
      <td>Short</td>
      <td>
        An intentionally long table cell that can truncate at narrow widths
      </td>
    </tr>
  </tbody>
</table>