Open In App

Semantic-UI Item Floated Content Variation

Last Updated : 13 Feb, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Semantic UI is a modern framework used in developing seamless designs for the website, It gives the user a lightweight experience with its components. It uses predefined CSS and jQuery to incorporate different frameworks.

Semantic UI Item presents a large collection of similar types of data on a site. The Item can contain an image, heading, description, buttons, date, etc. Item is the collection of items in Semantic UI.

Semantic UI Item Floated Content Variation is used to float any content inside the content container of the item left or right, using the floated class.

Semantic UI Item Floated Content Variation Classes:

  • left floated: This means that the content inside the Item will be floated in the left direction of the content.
  • right floated: This means that the content inside the Item will be floated in the right direction of the content.

Syntax: Add the left or right floated class to the content you want to change the float direction as follows:

<div class="ui items">
    <div class="item">
        ...
        <div class="content">
            ...
            <div class="ui right floated button"> ... </div>
        </div>
    </div>
</div>

Example: The below example illustrate the Semantic UI item floated variation. In this example, we have a button which we can left float or right float just by toggling the left floated and right floated class.

HTML




<!DOCTYPE html>
<html>
  <head>
    <link href=
        rel="stylesheet"
    />
    <script src=
    </script>
    <script src=
   </script>
  </head>
  <body>
    <div class="ui container">
      <center>
        <h1 class="ui header green">GeeksforGeeks</h1>
        <strong>Semantic UI Item Floated Content Variation</strong>
      </center>
    </div>
    <div class="ui items">
      <div class="item">
        <div class="ui small image">
          <img src=
          />
        </div>
        <div class="middle aligned content">
          <div class="header">
              Welcome to GeeksforGeeks
           </div>
          <div class="description">
             A computer science portal for geeks</div>
          <div class="extra">
            <button class="ui mini left floated button" 
                   onclick="toggleFloat()">
              Change Float direction
            </button>
          </div>
        </div>
      </div>
    </div>
    <script>
      function toggleFloat() {
        $("button").toggleClass("left floated")
          .toggleClass("right floated");
      }
    </script>
  </body>
</html>


Output:

Reference: https://semantic-ui.com/views/item.html#floated-content



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads