Table Classes DocumentationThis documentation outlines the structure, styling, and behavior of table-related classes
provided by the mastorsCDN CSS library. Two primary table styles are supported:
.table and .table-2, each with distinct features
and
optional modifiers.
.table ClassThe .table class provides a simple, clean, and fully responsive
table design with
a dark header and alternating row colors.
| Header 1 | Header 2 | Header 3 |
|---|---|---|
| Row 1, Cell 1 | Row 1, Cell 2 | Row 1, Cell 3 |
| Row 2, Cell 1 | Row 2, Cell 2 | Row 2, Cell 3 |
.table<table>, <thead>,
<tbody>, <tr>, <th>, <td>
width: 100% - Full-width table.border-collapse: collapse - Removes spacing between cells.<thead>):
background-color: $dark - Dark background for the header row.<th>:
color: white - White text.text-align: center - Centered text.padding: 1rem - Consistent padding.border: 1px solid $silver - Silver border around each header cell.<tbody>):
<tr>:
border: 1px solid $silver - Silver border around rows.padding: 0.5rem - Row padding.:nth-child(even) - Even rows have a light gray background
(#ececec).:hover - Rows lighten on hover (#f8f8f8).<td>:
text-align: center - Centered text.padding: 0.5rem - Consistent padding.border: 1px solid $silver - Silver border around each cell.<table class="table">
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 1, Cell 1</td>
<td>Row 1, Cell 2</td>
<td>Row 1, Cell 3</td>
</tr>
</tbody>
</table>.table-2 ClassThe .table-2 class offers a more modern and customizable table design with
scrollable options, hover effects, and additional modifiers.
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| Data 1 | Data 2 | Data 3 |
| Data 4 | Data 5 | Data 6 |
.table-2.scroll-x, .scroll-y, .border-all, .scale-1<table>, <thead>,
<tbody>, <tr>, <th>, <td>
width: 100% - Full-width table.border-collapse: separate - Maintains cell spacing.border-spacing: 0 - No gaps between cells.<thead>):
<th>:
background: #eeeeee - Light gray background.color: #333 - Dark text.padding: 1rem 1.5rem - Generous padding.text-align: center - Centered text.text-transform: uppercase - Uppercase text.:last-child - No right border on the last header cell.<tbody>):<tr>:
transition: background 0.3s ease - Smooth background transitions.:nth-child(even) - Even rows have a light blue-gray background
(#f7f9fc).:hover:not(:first-child) - Rows darken on hover (#e8ecef),
excluding the header.:last-child td - No bottom border on the last row's cells.<td>:
padding: 16px 20px - Spacious padding.color: #2d3436 - Dark gray text.vertical-align: middle - Vertically centered content.transition: background 0.3s ease - Smooth background transitions.:last-child - No right border on the last cell..scroll-x:
overflow-x: auto).overflow-y: hidden).max-width: 768px), enforces white-space: nowrap for horizontal
content..scroll-y:
overflow-y: auto).overflow-x: hidden)..scroll-x.scroll-y:
overflow-x: auto; overflow-y: auto).
.border-all:
border-top: 1px solid #ccc - Top border on <th>.border-right: 1px solid #ccc - Right border on <td> and
<th>.
border-bottom: 1px solid #ccc - Bottom border on <td> and
<th>.
border-left: 1px solid #ccc - Left border on first <td> and
<th> in each row.
.scale-1:
transition: transform 0.2s ease, background 0.3s ease - Smooth scaling and background
change.:hover:not(:first-child) - Scales to 1.01 and changes background to
#e8ecef.
height: 12px; width: 12px - Consistent scrollbar size.#ecf0f1) with rounded corners and subtle shadow.
#34495e to #5d788f).border: 2px solid #ecf0f1 - Light border.:hover - Darker gradient (#2c3e50 to #4b6580) with a
lighter border (#dfe6e9).:active - Solid dark color (#2c3e50).max-width: 768px):
display: block - Table becomes a block element.-webkit-overflow-scrolling: touch - Smooth scrolling on mobile.border: 1px solid #34495e - Adds a border around the table.<th>, <td>:
padding: 12px - Reduced padding.font-size: 0.9em - Smaller text..scroll-x - Enforces white-space: nowrap for horizontal
scrolling.<table class="table-2 border-all scroll-x scale-1">
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
<th>Column 4</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data 1</td>
<td>Data 2</td>
<td>Data 3</td>
<td>Data 4</td>
</tr>
</tbody>
</table>
.table and .table-2| Feature | .table |
.table-2 |
|---|---|---|
| Header Background | Dark ($dark) |
Light gray (#eeeeee) |
| Border Collapse | collapse |
separate |
| Row Hover Effect | Lightens (#f8f8f8) |
Darkens (#e8ecef) |
| Modifiers | None | .scroll-x, .scroll-y, .border-all, .scale-1 |
| Scrollbar Styling | None | Custom Webkit scrollbars |
| Responsive Design | Basic | Advanced (block display, touch scrolling) |
color-map file for variables like $dark and
$silver. Ensure this file is correctly imported.
.table-2 class is more feature-rich and suitable for complex, interactive
tables, while .table is ideal for simpler layouts.This documentation provides a comprehensive guide to using the table classes in your mastorsCDN library.