Last updated: 17 May 2024

Tailwind CSS Order

The order utility class in Tailwind CSS allows you to control the order of flex or grid items within a container.


Tailwind Order

The order utility class in Tailwind CSS allows you to control the order of flex or grid items within a container. With Tailwind's order class, you can easily adjust the positioning of elements within a flex or grid layout.

Applying Order

To apply the order to an element, you can use the order-{number} utility class, where {number} represents the desired order. The order value can be positive or negative. By default, elements have an order value of 0, which means they appear in their natural order.

html
<div class="flex">
<div class="bg-purple-500 order-3">Item 1</div>
<div class="bg-purple-500 order-2">Item 2</div>
<div class="bg-purple-500 order-1">Item 3</div>
</div>

Preview

Item 1
items 2
items 3

Responsive Order

Tailwind CSS allows you to apply the order classes responsively at different breakpoints. To use responsive order classes, you can append the breakpoint prefix to the utility class. For example, md:order-2 applies the order-2 class starting from the medium breakpoint and above.

html
<div class="flex">
<div class="bg-gray-200 md:order-2">Item 1</div>
<div class="bg-gray-200 order-1">Item 2</div>
<div class="bg-gray-200 order-3">Item 3</div>
</div>

In the above example, the order of the flex items is adjusted responsively using the md:order-2 class. The first flex item (Item 1) will have an order of 2 starting from the medium breakpoint and above.

Tailwind Order Class Table

ClassProperties
order-1 order: 1;
order-2order: 2;
order-3order: 3;
order-4order: 4;
order-5order: 5;
order-6order: 6;
order-7order: 7;
order-8order: 8;
order-9order: 9;
order-10order: 10;
order-11order: 11;
order-12order: 12;
order-firstorder: -9999;
order-last order: 9999;
order-noneorder: 0;

Windframe Tailwind blocks

Pricing

Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs

Start building stunning tailwind UIs! 

Build from scratch or select prebuilt tailwind templates