Tables

SkyLineCSS provides utility classes to style HTML tables with ease. These classes can be used to add borders, padding, alignment, and other styling to tables and their elements.

Basic Table

To create a basic table, use the .table class:

<table class="table">
  <thead>
    <tr>
      <th>Header 1</th>
      <th>Header 2</th>
      <th>Header 3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Data 1</td>
      <td>Data 2</td>
      <td>Data 3</td>
    </tr>
    <tr>
      <td>Data 4</td>
      <td>Data 5</td>
      <td>Data 6</td>
    </tr>
  </tbody>
</table>

Table Borders

You can add borders to the table and its cells using the following classes:

  • .table-bordered: Add borders to the table and cells

  • .border: Add border to individual cells

Example:

Table Striped Rows

To add striped rows to the table, use the .table-striped class:

Table Hover Effect

You can add a hover effect to the table rows using the .table-hover class:

Table Padding

To add padding to the table cells, use the following classes:

  • .p-1: Small padding

  • .p-2: Medium padding

  • .p-4: Large padding

Example:

Table Border Collapse

You can control the border collapse behavior using the following classes:

  • .border-collapse: Collapse borders

  • .border-separate: Separate borders

Example:

Table Border Spacing

To adjust the border spacing between cells, use the following classes:

  • .border-spacing: No border spacing

  • .border-spacing-2: 2px border spacing

  • .border-spacing-4: 4px border spacing

Example:

Table Layout

You can control the table layout using the following classes:

  • .table-auto: Automatic table layout

  • .table-fixed: Fixed table layout

Example:

Table Caption Side

You can position the table caption using the following classes:

  • .caption-top: Position caption on top

  • .caption-bottom: Position caption on bottom

Example:

Responsive Tables

SkyLineCSS provides responsive classes for tables. Here's an example:

Complete Example

Here's a complete example combining different table styles:

These are some of the available table styling utilities in SkyLineCSS. You can combine these classes to create stylish and responsive tables for your projects.

Last updated