# Table layout

> Utilities for controlling the table layout algorithm.

Source: https://www.zenplates.co/documentation/utilities/table-layout (Utilities › Tables)

| Class          | Properties             |
| -------------- | ---------------------- |
| `.table-auto`  | `table-layout: auto;`  |
| `.table-fixed` | `table-layout: fixed;` |

## Usage

Use `.table-auto` to allow the table to automatically size columns to fit the contents of the cell.

```html
<table class="table table-auto">
  <tr>
    <th>Request title</th>
    <th>Requester</th>
  </tr>
  <tr>
    <td>My printer is on fire!</td>
    <td>John Smith</td>
  </tr>
  <tr>
    <td>Please help me with this really long winded request.</td>
    <td>Jane Doe</td>
  </tr>
</table>
```

Use `.table-fixed` to allow the table to ignore the content and use fixed widths for columns.

```html
<table class="table table-fixed">
  <tr>
    <th>Request title</th>
    <th>Requester</th>
  </tr>
  <tr>
    <td>My printer is on fire!</td>
    <td>John Smith</td>
  </tr>
  <tr>
    <td>Please help me with this really long winded request.</td>
    <td>Jane Doe</td>
  </tr>
</table>
```

The width of the first row will set the column widths for the whole table.

You can manually set the widths for some columns and the rest of the available width will be divided evenly among the columns without explicit width.

## Variants

By default, no responsive or hover-state variants are generated for table layout utilities.

### Responsive

To include responsive variants like `.md:table-fixed`, add `"table-layout"` to the `$responsive-variants` variable in your theme's `_variables.scss` file when [recompiling your CSS](https://www.zenplates.co/documentation/customization/using-sass-source-files):

```scss
$responsive-variants: (
  // ...
  "table-layout",
);
```

### Hover-state

To include hover-state variants like `.hover:table-fixed`, add `"table-layout"` to the `$hover-variants` variable:

```scss
$hover-variants: (
  // ...
  "table-layout",
);
```
