Open In App

Tailwind CSS Flex Grow

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

The CSS flexbox is a vital feature to develop the frontend, there is two flex-grow available in tailwind CSS all the properties are covered as in class form. It is the alternative of CSS flex grow Property for the fast development of the front-end. This class specifies how much the item will grow compared to other items inside that container. In other words, it is the ability of an item to grow compared to other items present inside the same container.

Flex Grow: 

  • flex-grow-0 
  • flex-grow

flex-grow-0: This class restricts the growing feature, it has the ability of an item to grow compared to content present inside the same container.

Syntax:

<element class="flex-grow-0"> Contents... </element>

Example:

HTML




<!DOCTYPE html> 
<html>
  
<head
    <title>Tailwind flex-grow-0 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 flex-grow-0 Class</b
  
    <div id="main" class="flex justify-evenly space-x-2 ml-12 mr-12">
        <div class="rounded bg-green-600 flex-grow h-12 ">
            Side Part</div
        <div class="rounded bg-green-300 flex-grow-0 h-12">
            Flex-Grow-0
        </div
        <div class="rounded bg-green-600 flex-grow h-12 mr-12">
            Side Part</div
    </div
</body
  
</html>


Output:

flex-grow: This class does not restrict the growing feature, it has the ability of an item to grow compared to the space left on the screen.

Syntax:

<element class="flex-grow"> Contents... </element>

Example:

HTML




<!DOCTYPE html>
<html>
   
<head
    <title>Tailwind flex-grow 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 flex-grow Class</b
  
    <div id="main" class="flex justify-evenly space-x-2 ml-12 mr-12"
        <div class="rounded bg-green-600  w-24 h-12 ">Side Part</div
        <div class="rounded bg-green-300 flex-grow h-12">
            TailWind CSS Flex-Grow
        </div
        <div class="rounded bg-green-600  w-24 h-12 mr-12">Side Part</div>
    </div
</body
  
</html>


Output:



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