Open In App

Tailwind CSS Order

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

Order is one of the best feature of tailwind CSS by using this class we can order the flex and grid items according to our requirements. There are lots of order class. This class is used to render flex and grid items in a different order than they appear in the DOM.

Order:

  • order-1
  • order-2
  • order-3
  • order-4
  • order-5
  • order-6
  • order-7
  • order-8
  • order-9
  • order-10
  • order-11
  • order-12
  • order-first
  • order-last
  • order-none

Syntax:

<element order- number | string >

Parameter: This class accepts two types of parameters, but one at a time, can only follow the order number or the position you will mention.

  • number: Integer number to follow the order index.
  • string: In word order index position, only accept last and first.

Example: In this example, we set the order-last on the first flex item and set the order-first on the 5th flex item, now you can see the order list is different from the normal.

HTML




<!DOCTYPE html> 
<html>
  
<head
    <title>Tailwind order Class</title
  
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
          rel="stylesheet"
</head
  
<body class="text-center"
    <h1 class="text-green-600 text-5xl font-bold">
        GeeksforGeeks
    </h1
  
    <b>Tailwind CSS order Class</b
  
    <div id="main" class="flex flex-row justify-evenly"
        <div class="bg-green-900 order-last w-24 h-12">1</div
        <div class="bg-green-800 w-24 h-12">2</div
        <div class="bg-green-700 w-24 h-12">3</div
        <div class="bg-green-600 w-24 h-12">4</div
        <div class="bg-green-500 order-first w-24 h-12">5</div
        <div class="bg-green-400 w-24 h-12">6</div
    </div
</body
  
</html>


Output:



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