Open In App

Semantic-UI Table Stacking Variation

Improve
Improve
Like Article
Like
Save
Share
Report

Semantic UI is an open-source framework that uses CSS and jQuery to build great user interfaces. It is the same as a bootstrap for use and has great different elements to use to make your website look more amazing. It uses a class to add CSS to the elements.

Tables are an easy way to organize a lot of data. A table is an arrangement of data in rows and columns, or possibly in a more complex structure. Tables are widely used in communication, research, and data analysis. Tables are useful for various tasks such as presenting text information and numerical data. It can be used to compare two or more items in the tabular form layout. Tables are used to create databases. An HTML table and a Semantic UI table both are the same structurally.

Table stacking variation of Semantic UI specifies how that table stacks table content responsively.

Semantic UI Table Stacking Variation Classes:

  • stackable: This class stacks the table responsively.
  • unstackable: This class divides each row of our table into separate cells.

Syntax:

<table class="ui stackable table">
    <tr>
        <td></td>
        ...
    </tr>
    ...
</table>

Example 1: This is a basic example illustrating the difference between a normal unstackable table and a stackable table on tablet size devices created using Semantic UI.

HTML




<!DOCTYPE html>
<html>
<head>
    <title>Semantic-UI Table Stacking Variation</title>
    <link href=
          rel="stylesheet" />
</head>
<body>
    <center>
        <h1 class="ui green header">GeeksforGeeks</h1>
        <strong>Semantic-UI Table Stacking Variation</strong>
    </center>
    <b>Normal Table</b>
    <table class="ui unstackable table">
        <thead>
            <tr>
                <th>Names</th>
                <th>Maths Marks</th>
                <th>Physics Marks</th>
                <th>Chemistry Marks</th>
            </tr>
        </thead>
        <tbody>
          <tr>
            <td>Ravi</td>
            <td>48</td>
            <td>84</td>
            <td>63</td>
          </tr>
          <tr>
            <td>Srihita</td>
            <td>55</td>
            <td>97</td>
            <td>74</td>
          </tr>
      </tbody>
    </table>
    <b>Stackable Table</b>
    <table class="ui tablet stackable table">
        <thead>
            <tr>
                <th>Names</th>
                <th>Maths Marks</th>
                <th>Physics Marks</th>
                <th>Chemistry Marks</th>
            </tr>
        </thead>
        <tbody>
          <tr>
            <td>Ravi</td>
            <td>48</td>
            <td>84</td>
            <td>63</td>
          </tr>
          <tr>
            <td>Srihita</td>
            <td>55</td>
            <td>97</td>
            <td>74</td>
          </tr>
      </tbody>
    </table>
</body>
</html>


Output:

Semantic-UI Table Stacking Variation

Semantic-UI Table Stacking Variation

Example 2: This is a basic example illustrating colored (inverted) stackable table variation on tablet size devices created using Semantic UI.

HTML




<!DOCTYPE html>
<html>
<head>
    <title>Semantic-UI Table Stacking Variation</title>
    <link href=
         rel="stylesheet" />       
</head>
<body>
    <center>
        <h1 class="ui green header">GeeksforGeeks</h1>
        <strong>Semantic-UI Table Stacking Variation</strong>
    </center>
    <table class="ui tablet inverted blue stackable table">
        <thead>
            <tr>
                <th>Names</th>
                <th>Maths Marks</th>
                <th>Physics Marks</th>
                <th>Chemistry Marks</th>
            </tr>
        </thead>
        <tbody>
          <tr>
            <td>Ravi</td>
            <td>48</td>
            <td>84</td>
            <td>63</td>
          </tr>
          <tr>
            <td>Srihita</td>
            <td>55</td>
            <td>97</td>
            <td>74</td>
          </tr>
      </tbody>
    </table>
</body>
</html>


Output:

Semantic-UI Table Stacking Variation

Semantic-UI Table Stacking Variation

Reference: https://semantic-ui.com/collections/table.html#stacking



Last Updated : 17 Mar, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads