Tailwind CSS Grid Auto Flow

Lớp này chấp nhận nhiều giá trị trong Tailwind CSS và bao gồm tất cả thuộc tính. Nó là một lựa chọn thay thế cho thuộc tính CSS grid-auto-flow. Nó được dùng để chỉ định cách các mục tự động được đặt vào các mục lưới trong Tailwind CSS.

Grid Auto Flow:

  • grid-flow-row
  • grid-flow-col
  • grid-flow-row-dense
  • grid-flow-col-dense

grid-flow-row: Thuật toán tự động đặt các mục bằng cách lấp đầy từng hàng. Sau đó, nó thêm các hàng mới khi cần thiết.

Syntax:

<element class="grid-flow-row"> Contents... </element>

Example:

HTML
<!DOCTYPE html> 
<html>

<head> 
    <title>Tailwind grid-flow-row 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 grid-flow-row Class</b> 

    <div class = "m-8 grid grid-flow-row gap-1">  
        <div class = "bg-green-300 rounded-lg">1</div>  
        <div class = "bg-green-300 rounded-lg">2</div>  
        <div class = "bg-green-300 rounded-lg">3</div>  
        <div class = "bg-green-300 rounded-lg">4</div>  
    </div>  
</body> 
  
</html>  

Output:

tailwind-css-grid-auto-flow

grid-flow-col: Thuật toán tự động đặt các mục bằng cách lấp đầy từng cột. Sau đó, nó thêm các cột mới khi cần thiết.

Syntax:

<element class="grid-flow-col"> Contents... </element>

Example:

HTML
<!DOCTYPE html> 
<html>

<head> 
    <title>Tailwind grid-flow-col 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 grid-flow-col Class</b> 

    <div class = "m-8 grid grid-flow-col gap-1">  
        <div class = "bg-green-300 rounded-lg">1</div>  
        <div class = "bg-green-300 rounded-lg">2</div>  
        <div class = "bg-green-300 rounded-lg">3</div>  
        <div class = "bg-green-300 rounded-lg">4</div>  
    </div>  
</body> 
  
</html>  

Output:

tailwind-css-grid-auto-flow

grid-flow-row-dense: Chỉ định thuật toán tự động sắp xếp sử dụng thuật toán đóng gói "dense" cho cột.

Syntax:

<element class="grid-flow-row-dense"> Contents... </element>

Example:

HTML
<!DOCTYPE html>
<html>
 
<head> 
    <title>Tailwind grid-flow-row-dense 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 grid-flow-row-dense Class</b> 

    <div class = "m-8 grid grid-flow-row-dense gap-1">  
        <div class = "bg-green-300 rounded-lg">1</div>  
        <div class = "bg-green-300 rounded-lg">2</div>  
        <div class = "bg-green-300 rounded-lg">3</div>  
        <div class = "bg-green-300 rounded-lg">4</div>  
    </div>  
</body> 
  
</html>  

Output:

tailwind-css-grid-auto-flow

grid-flow-col-dense: Chỉ định thuật toán tự động sắp xếp sử dụng thuật toán đóng gói "dense" cho hàng.

Syntax:

<element class="grid-flow-col-dense">..</element>

Example:

HTML
<!DOCTYPE html> 
<html>

<head> 
    <title>Tailwind grid-flow-col-dense 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 grid-flow-col-dense Class</b> 

    <div class = "m-8 grid grid-flow-col-dense gap-1">  
        <div class = "bg-green-300 rounded-lg">1</div>  
        <div class = "bg-green-300 rounded-lg">2</div>  
        <div class = "bg-green-300 rounded-lg">3</div>  
        <div class = "bg-green-300 rounded-lg">4</div>  
    </div>  
</body> 
  
</html>  

Output:

tailwind-css-grid-auto-flow
Last Updated : 20/07/2025