Open In App

How to implement the Order Utility in Tailwind CSS ?

Last Updated : 05 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Tailwind CSS Order utility class is used to control the visual order of flex or grid items. It allows you to rearrange elements without modifying the underlying HTML structure, enhancing flexibility in the layout design.

Syntax

<div class="flex">
<div class="order-2">Second</div>
<div class="order-1">First</div>
</div>

Here, the order-[number] Class sets the order of the elements within the flex or grid container. The lower the number, the earlier it appears.

Key Features

  • Flexibility in Layout: order provides a way to visually rearrange elements, giving designers more control over the layout without altering the HTML structure.
  • Responsive Order: Like other Tailwind classes, the order the class can be used with responsive variants (sm:, md:, lg:, xl:) for different ordering at various screen sizes.
  • Efficiency: The utility-first approach of Tailwind enables quick and easy implementation of the order class without the need for custom CSS.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads