Open In App

Semantic-UI Table Text Alignment Variation

Last Updated : 21 Mar, 2022
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.

Using Table Text Alignment variation, we can adjust the text alignment of a table header, row, or cell.

Semantic UI Table Text Alignment Variation Classes:

  • right aligned: This class aligns the text on the right side.
  • center aligned: This class aligns the text on the center.
  • left aligned: This class aligns the text on the left side.

Syntax:

<table class="ui table">
    <tr>
        <td class="right aligned">...</td>
        ...
    </tr>
    ...
</table>

Example 1: This is a basic example illustrating different Table Text Alignment variations created using Semantic UI.

HTML




<!DOCTYPE html>
<html>
    <head>
        <title>Semantic-UI Table Text Alignment Variation</title>
        <link href=
              rel="stylesheet" />
       
    </head>
    <body>
        <center>
            <h1 class="ui green header">GeeksforGeeks</h1>
            <strong>Semantic-UI Table Text Alignment Variation</strong>
        </center>
        <table class="ui celled table">
            <thead>
                <tr>
                    <th>Data Structures</th>
                    <th>Access</th>
                    <th class="right aligned">Insertion</th>
                    <th>Deletion</th>
                    <th>Search</th>
                </tr>
            </thead>
            <tbody>
              <tr>
                <td class="center aligned">Array</td>
                <td>O(1)</td>
                <td class="right aligned">O(n)</td>
                <td class="right aligned">O(n)</td>
                <td class="right aligned">O(n)</td>
              </tr>
              <tr>
                <td class="right aligned">LinkedList</td>
                <td>O(n)</td>
                <td>O(1)</td>
                <td>O(1)</td>
                <td class="right aligned">O(n)</td>
              </tr>
              <tr>
                <td class="center aligned">AVL Tree</td>
                <td class="center aligned">O(log n)</td>
                <td class="center aligned">O(log n)</td>
                <td class="center aligned">O(log n)</td>
                <td class="center aligned">O(log n)</td>
              </tr>
              <tr>
                <td class="right aligned">HashMap</td>
                <td>N/A</td>
                <td>O(1)</td>
                <td>O(1)</td>
                <td>O(1)</td>
              </tr>
          </tbody>
        </table>
    </body>
</html>


Output:

Semantic-UI Table Text Alignment Variation

Semantic-UI Table Text Alignment Variation

Example 2: This is a basic example illustrating different Collapsed Table Text Alignment variations created using Semantic UI.

HTML




<!DOCTYPE html>
<html>
    <head>
        <title>Semantic-UI Table Text Alignment Variation</title>
        <link href=
              rel="stylesheet" />       
    </head>
    <body>
        <center>
            <h1 class="ui green header">GeeksforGeeks</h1>
            <strong>Semantic-UI Table Text Alignment Variation</strong>
        </center>
        <table class="ui celled collapsing table">
            <thead>
                <tr>
                    <th>Data Structures</th>
                    <th>Access</th>
                    <th class="right aligned">Insertion</th>
                    <th>Deletion</th>
                    <th>Search</th>
                </tr>
            </thead>
            <tbody>
              <tr>
                <td class="center aligned">Array</td>
                <td>O(1)</td>
                <td class="right aligned">O(n)</td>
                <td class="right aligned">O(n)</td>
                <td class="right aligned">O(n)</td>
              </tr>
              <tr>
                <td class="right aligned">LinkedList</td>
                <td>O(n)</td>
                <td>O(1)</td>
                <td>O(1)</td>
                <td class="right aligned">O(n)</td>
              </tr>
              <tr>
                <td class="center aligned">AVL Tree</td>
                <td class="center aligned">O(log n)</td>
                <td class="center aligned">O(log n)</td>
                <td class="center aligned">O(log n)</td>
                <td class="center aligned">O(log n)</td>
              </tr>
              <tr>
                <td class="right aligned">HashMap</td>
                <td>N/A</td>
                <td>O(1)</td>
                <td>O(1)</td>
                <td>O(1)</td>
              </tr>
          </tbody>
        </table>
    </body>
</html>


Output:

Semantic-UI Table Text Alignment Variation

Semantic-UI Table Text Alignment Variation

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



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads