Creating tables

Tables are a built-in feature of Zendesk Guide and our themes provide a variety of different styles that you can use with them.

On this page

You can add tables (Add table button) to your help center articles using the Zendesk article editor toolbar. The table formatting options available depend on whether or not you are displaying unsafe content in articles.

Styles

Every table is styled by default, with a border around the table and its cells and a heading row that stands out from the rest of the table. You don’t need to add any classes to the tables you add with the article editor.

To use one of the other styles below, edit the article’s source code and add the class to the <table> element.

<table>
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <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>

Use .hover:bg-{color} utilities such as .hover:bg-subtle to highlight rows when they’re hovered:

<table>
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr class="hover:bg-subtle">
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr class="hover:bg-subtle">
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr class="hover:bg-subtle">
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Row borders

Use .table-rows to only show borders between rows.

<table class="table-rows">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <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 colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Borderless table

Use .table-borderless for a table without borders.

<table class="table-borderless">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <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 colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Flush table

Use .table-flush to remove the padding before the first column and after the last column, so that the table’s content lines up with the content around it. It works well with .table-rows and .table-borderless.

<table class="table-rows table-flush">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <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 colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Sizes

Use .table-sm for a compact table with less padding and a smaller font size, or .table-lg for a table with more padding.

<table class="table-sm">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <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 colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>
<table class="table-lg">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <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 colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Responsive

Use .table-responsive on a table, or wrap it in an element with the .scroll-x utility, to let it scroll horizontally when it’s wider than the space available.

<table class="table-responsive">
  ...
</table>

To only scroll on smaller screens, wrap the table in an element with a {screen}:scroll-x class. For example, a table inside .md:scroll-x scrolls below the medium breakpoint and displays normally from the medium breakpoint up.

Customization

The appearance of tables is controlled by CSS variables, which you can change in your theme’s CSS or with the $padding-table-cell, $font-size-table, $border-color-table and related Sass variables when recompiling your CSS.

VariableDefault in Ada
--font-size-table14px (var(--font-size-table-sm) for .table-sm, var(--font-size-table-lg) for .table-lg)
--padding-table-cell.5em (var(--padding-table-cell-sm) for .table-sm, var(--padding-table-cell-lg) for .table-lg)
--padding-table-header-cell.875em .5em
--color-table-headervar(--color-heading)
--bg-color-table-headertransparent
--border-color-tablevar(--border-color)
--border-width-tablevar(--border-width)

For header cells, .table-sm uses padding: var(--padding-table-header-cell-sm); and .table-lg uses padding: var(--padding-table-header-cell-lg);.

Questions or feedback about this article? Let us know