Open In App

Foundation CSS Stacked Table

Last Updated : 09 Mar, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Foundation CSS is an open-source & responsive front-end framework built by ZURB foundation in September 2011, that makes it easy to design beautiful responsive websites, apps, and emails that look amazing & can be accessible to any device. It is used by many companies such as Facebook, eBay, Mozilla, Adobe, and even Disney. The framework is built on Saas-like bootstrap. It is more sophisticated, flexible, and easily customizable. It also comes with CLI, so it’s easy to use it with module bundlers. It offers the Fastclick.js tool for faster rendering on mobile devices.

The table is a basic cell layout that contains data in rows and columns. Foundation CSS provides various variations of <table> elements with the predefined classes such as a basic table, stripes table, hover state table, scrolling table, and stacked table. In this article, we will learn about the Stacked Table Variation.

The Stacked Table is a table layout that stacks its cells on top of each other on small screens to make the layout responsive and consistent on all screen sizes. To convert a basic Foundation CSS table into a stackable table, we use the stack class. The .stack class is used inside <table> element of HTML.

Foundation CSS Stacked table Class:

  • stack: This class converts a basic table to a stackable table where all cells stack below each other in smaller screen sizes.

Syntax:

<table class="stack"> </table>

Example 1: This is a basic demonstration of a stackable table in Foundation CSS.

HTML




<!DOCTYPE html>
<html lang="en">
  
<head>
    <!-- Compressed CSS -->
    <link rel="stylesheet" href=
  
    <!-- Compressed JavaScript -->
    <script src=
    </script>
    <script src=
    </script>
</head>
  
<body style="padding: 30px;">
    <center>
        <h1 style="color: green;">
            GeeksforGeeks
        </h1>
        <strong>Foundation CSS Stackable table</strong>
        <br /><br />
    </center>
    <table class="stack">
        <thead>
            <tr>
                <th width="200">Table Header</th>
                <th>Table Header</th>
                <th width="150">Table Header</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>GeeksforGeeks</td>
                <td>It contains well written, well thought
                    and well explained computer science and
                    programming articles</td>
                <td>A Computer Science portal for geeks.</td>
            </tr>
            <tr>
                <td>GeeksforGeeks</td>
                <td>It contains well written, well thought
                    and well explained computer science and
                    programming articles</td>
                <td>A Computer Science portal for geeks.</td>
            </tr>
            <tr>
                <td>GeeksforGeeks</td>
                <td>It contains well written, well thought
                    and well explained computer science and
                    programming articles</td>
                <td>A Computer Science portal for geeks.</td>
            </tr>
            <tr>
                <td>GeeksforGeeks</td>
                <td>It contains well written, well thought
                    and well explained computer science and
                    programming articles</td>
                <td>A Computer Science portal for geeks.</td>
            </tr>
        </tbody>
    </table>
    <script>
        $(document).foundation();
    </script>
</body>
  
</html>


Output:

Example 2: This is a basic demonstration of an unstriped stackable table in Foundation CSS.

HTML




<!DOCTYPE html>
<html lang="en">
  
<head>
    <!-- Compressed CSS -->
    <link rel="stylesheet" href=
  
    <!-- Compressed JavaScript -->
    <script src=
    </script>
    <script src=
    </script>
</head>
  
<body style="padding: 30px;">
    <center>
        <h1 style="color: green;">
            GeeksforGeeks
        </h1>
        <strong>Foundation CSS Stackable table</strong>
        <br /><br />
    </center>
    <table class="stack unstriped">
        <thead>
            <tr>
                <th width="200">Table Header</th>
                <th>Table Header</th>
                <th width="150">Table Header</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>GeeksforGeeks</td>
                <td>It contains well written, well thought
                  and well explained computer science and
                  programming articles</td>
                <td>A Computer Science portal for geeks.</td>
            </tr>
            <tr>
                <td>GeeksforGeeks</td>
                <td>It contains well written, well thought
                  and well explained computer science and
                  programming articles</td>
                <td>A Computer Science portal for geeks.</td>
            </tr>
            <tr>
                <td>GeeksforGeeks</td>
                <td>It contains well written, well thought
                  and well explained computer science and
                  programming articles</td>
                <td>A Computer Science portal for geeks.</td>
            </tr>
            <tr>
                <td>GeeksforGeeks</td>
                <td>It contains well written, well thought
                  and well explained computer science and
                  programming articles</td>
                <td>A Computer Science portal for geeks.</td>
            </tr>
        </tbody>
    </table>
    <script>
        $(document).foundation();
    </script>
</body>
  
</html>


Output:

Reference: https://get.foundation/sites/docs/table.html#stacked-table



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads