Skip to content
This repository has been archived by the owner on Dec 11, 2021. It is now read-only.

Commit

Permalink
Tables: Add fullwidth table option
Browse files Browse the repository at this point in the history
  • Loading branch information
kristyjy committed Jun 14, 2016
1 parent 5d8723e commit 8410e05
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
36 changes: 36 additions & 0 deletions demos/tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ <h1>CSS Chassis</h1>

<h2>Tables</h2>

<h3>Basic Table</h3>
<p>Here's a paragraph to show spacing around the table. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum..</p>

<table class="table">
Expand Down Expand Up @@ -50,6 +51,7 @@ <h2>Tables</h2>
</tbody>
</table>

<h3>Div Table</h3>
<p>Here's a paragraph to show spacing around the table. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum..</p>

<div class="table">
Expand Down Expand Up @@ -83,5 +85,39 @@ <h2>Tables</h2>
</div>
</div>

<h3>Full Width Table</h3>
<p>Here's a paragraph to show spacing around the table. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum..</p>

<table class="table-fullwidth">
<thead class="table-head">
<tr class="table-row">
<th class="table-heading" scope="col">ID</th>
<th class="table-heading" scope="col">Product</th>
<th class="table-heading" scope="col">Category</th>
<th class="table-heading" scope="col">Price</th>
</tr>
</thead>
<tbody class="table-body">
<tr class="table-row">
<th class="table-heading" scope="row">1</th>
<td class="table-cell">T-Shirt</td>
<td class="table-cell">Apparel</td>
<td class="table-cell">$12.99</td>
</tr>
<tr class="table-row">
<th class="table-heading" scope="row">2</th>
<td class="table-cell">Sweat Shirt</td>
<td class="table-cell">Apparel</td>
<td class="table-cell">$24.99</td>
</tr>
<tr class="table-row">
<th class="table-heading" scope="row">3</th>
<td class="table-cell">Necklace</td>
<td class="table-cell">Accessories</td>
<td class="table-cell">$29.99</td>
</tr>
</tbody>
</table>

</body>
</html>
6 changes: 6 additions & 0 deletions scss/atoms/tables/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
* Table mixins
* ==========================================================================
*/
@mixin table($margin, $font-size) {
display: table;
margin: $margin;
font-size: $font-size;
text-align: left;
}
10 changes: 6 additions & 4 deletions scss/atoms/tables/_tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
"mixins";

.table {
display: table;
margin: map-get($table-base, margin);
font-size: map-get($table-base, font-size);
text-align: left;
@include table(map-get($table-base, margin), map-get($table-base, font-size));
}

.table-fullwidth {
width: 100%;
@include table(map-get($table-base, margin), map-get($table-base, font-size));
}

/* thead */
Expand Down

0 comments on commit 8410e05

Please sign in to comment.