biofriction-wp-theme/node_modules/foundation-sites/docs/pages/table.md

313 lines
8.8 KiB
Markdown
Raw Normal View History

2021-10-26 14:18:09 +02:00
---
title: Tables
description: Okay, they're not the sexiest things ever, but tables get the job done (for tabular data, of course). They have responsive modifiers to help solve some of your layout issues based on your tables needs.
video: '-Omv7c3Qg4s'
sass: scss/components/_table.scss
---
## Basics
No bells or whistles here, just a straight up table for all of your basic table needs.
<p>
<a class="" data-open-video="0:28"><img src="{{root}}assets/img/icons/watch-video-icon.svg" class="video-icon" height="30" width="30" alt=""> Watch this part in video</a>
</p>
<div class="docs-codepen-container">
<a class="codepen-logo-link" href="http://codepen.io/ZURBFoundation/pen/zwaazZ?editors=1000" target="_blank"><img src="{{root}}assets/img/logos/edit-in-browser.svg" class="" height="" width="" alt="edit on codepen button"></a>
</div>
```html_example
<table>
<thead>
<tr>
<th width="200">Table Header</th>
<th>Table Header</th>
<th width="150">Table Header</th>
<th width="150">Table Header</th>
</tr>
</thead>
<tbody>
<tr>
<td>Content Goes Here</td>
<td>This is longer content Donec id elit non mi porta gravida at eget metus.</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
</tr>
<tr>
<td>Content Goes Here</td>
<td>This is longer Content Goes Here Donec id elit non mi porta gravida at eget metus.</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
</tr>
<tr>
<td>Content Goes Here</td>
<td>This is longer Content Goes Here Donec id elit non mi porta gravida at eget metus.</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
</tr>
</tbody>
</table>
```
---
## Hover State
Need to spiff up the table just a tad? Just add the class `.hover` to lightly darken the table rows on hover.
<p>
<a class="" data-open-video="2:49"><img src="{{root}}assets/img/icons/watch-video-icon.svg" class="video-icon" height="30" width="30" alt=""> Watch this part in video</a>
</p>
<div class="docs-codepen-container">
<a class="codepen-logo-link" href="http://codepen.io/ZURBFoundation/pen/xdzzgr?editors=1000" target="_blank"><img src="{{root}}assets/img/logos/edit-in-browser.svg" class="" height="" width="" alt="edit on codepen button"></a>
</div>
```html
<table class="hover">
</table>
```
<table class="hover">
<thead>
<tr>
<th width="200">Table Header</th>
<th>Table Header</th>
<th width="150">Table Header</th>
<th width="150">Table Header</th>
</tr>
</thead>
<tbody>
<tr>
<td>Content Goes Here</td>
<td>This is longer content Donec id elit non mi porta gravida at eget metus.</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
</tr>
<tr>
<td>Content Goes Here</td>
<td>This is longer Content Goes Here Donec id elit non mi porta gravida at eget metus.</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
</tr>
<tr>
<td>Content Goes Here</td>
<td>This is longer Content Goes Here Donec id elit non mi porta gravida at eget metus.</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
</tr>
</tbody>
</table>
---
## Stripes
By default, table rows are striped. There's an `.unstriped` class to remove the stripes. If you change `$table-is-striped` to `false` to remove stripes from all tables, use the `.striped` class to add stripes.
<p>
<a class="" data-open-video="2:18"><img src="{{root}}assets/img/icons/watch-video-icon.svg" class="video-icon" height="30" width="30" alt=""> Watch this part in video</a>
</p>
<div class="docs-codepen-container">
<a class="codepen-logo-link" href="http://codepen.io/IamManchanda/pen/MmBQag?editors=1000" target="_blank"><img src="{{root}}assets/img/logos/edit-in-browser.svg" class="" height="" width="" alt="edit on codepen button"></a>
</div>
```html
<table class="unstriped">
</table>
```
<table class="unstriped">
<thead>
<tr>
<th width="200">Table Header</th>
<th>Table Header</th>
<th width="150">Table Header</th>
<th width="150">Table Header</th>
</tr>
</thead>
<tbody>
<tr>
<td>Content Goes Here</td>
<td>This is longer content Donec id elit non mi porta gravida at eget metus.</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
</tr>
<tr>
<td>Content Goes Here</td>
<td>This is longer Content Goes Here Donec id elit non mi porta gravida at eget metus.</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
</tr>
<tr>
<td>Content Goes Here</td>
<td>This is longer Content Goes Here Donec id elit non mi porta gravida at eget metus.</td>
<td>Content Goes Here</td>
<td>Content Goes Here</td>
</tr>
</tbody>
</table>
---
## Stacked Table
To stack a table on small screens, add the class `.stack`.
<p>
<a class="" data-open-video="3:23"><img src="{{root}}assets/img/icons/watch-video-icon.svg" class="video-icon" height="30" width="30" alt=""> Watch this part in video</a>
</p>
<div class="docs-codepen-container">
<a class="codepen-logo-link" href="http://codepen.io/IamManchanda/pen/EmpQPK?editors=1000" target="_blank"><img src="{{root}}assets/img/logos/edit-in-browser.svg" class="" height="" width="" alt="edit on codepen button"></a>
</div>
```html
<table class="stack">
</table>
```
<table class="stack">
<thead>
<tr>
<th>Cookies</th>
<th>Taste</th>
<th>Calories</th>
<th>Overall</th>
</tr>
</thead>
<tbody>
<tr>
<td>Chocolate Chip</td>
<td>Tastey</td>
<td>120cal</td>
<td>7.5/10</td>
</tr>
<tr>
<td>Snickerdoodle</td>
<td>Delicious</td>
<td>95cal</td>
<td>8/10</td>
</tr>
<tr>
<td>Oatmeal Raisin</td>
<td>Superb</td>
<td>10cal</td>
<td>11/10</td>
</tr>
</tbody>
</table>
---
## Scrolling Table
Got a lot of tubular tabular data? Add a wrapper element with the class `.table-scroll` around your table to enable horizontal scrolling.
<p>
<a class="" data-open-video="3:48"><img src="{{root}}assets/img/icons/watch-video-icon.svg" class="video-icon" height="30" width="30" alt=""> Watch this part in video</a>
</p>
<div class="primary callout">
<p>The wrapping element was added in Foundation 6.2&mdash;prior to that, you just added the class <code>.scroll</code> to the table itself. However, this method doesn't work great with Internet Explorer 9. <strong>If you don't need IE9 support, you can just add <code>.scroll</code> to your table, and the wrapping element isn't necessary.</strong>
</div>
<div class="docs-codepen-container">
<a class="codepen-logo-link" href="http://codepen.io/IamManchanda/pen/vmadKp?editors=1000" target="_blank"><img src="{{root}}assets/img/logos/edit-in-browser.svg" class="" height="" width="" alt="edit on codepen button"></a>
</div>
```html
<div class="table-scroll">
<table></table>
</div>
```
<div class="table-scroll">
<table>
<thead>
<tr>
<th>This is the description!</th>
<th>One</th>
<th>Two</th>
<th>Three</th>
<th>Four</th>
<th>Five</th>
<th>Six</th>
<th>Seven</th>
<th>Eight</th>
<th>Nine</th>
<th>Ten</th>
<th>Eleven</th>
<th>Twelve</th>
</tr>
</thead>
<tbody>
<tr>
<td style="display:block; width:400px;">These are all the words that people use to describe Foundation 6!</td>
<td>Cool</td>
<td>Swag</td>
<td>Chill</td>
<td>Killer</td>
<td>Rad</td>
<td>Baller</td>
<td>OMG</td>
<td>Sweet</td>
<td>Awesome</td>
<td>Beast</td>
<td>Dope</td>
<td>Tubular</td>
</tr>
<tr>
<td>These are some words that people use to describe other web frameworks.</td>
<td>Whatevs</td>
<td>Ugh.</td>
<td>LOL</td>
<td>K</td>
<td>Aight</td>
<td>Eh.</td>
<td>Grrr...</td>
<td>Meh.</td>
<td>TTYL</td>
<td>Bleh.</td>
<td>Really?</td>
<td>Why?</td>
</tr>
<tr>
<td>Here are some great super heros.</td>
<td>Batman</td>
<td>Superman</td>
<td>Spiderman</td>
<td>Wonder Woman</td>
<td>Hulk</td>
<td>Nicolas Cage</td>
<td>Antman</td>
<td>Aquaman</td>
<td>Captain America</td>
<td>Wolverine</td>
<td>Thor</td>
<td>Iron Man</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>Here's a footer, just in case</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</div>