Grid-cols-2: Tailwind CSS Grid class

The grid-cols-2 class defines a grid layout with two columns.


grid-cols-2

The grid-cols-2 class defines a grid layout with two columns.

Example Code

html
<div class="rounded-t-md p-4 bg-indigo-50">
<div class="grid grid-cols-2 gap-4">
<div class="bg-indigo-500 text-white p-4 font-bold text-center">A</div>
<div class="bg-indigo-500 text-white p-4 font-bold text-center">B</div>
<div class="bg-indigo-500 text-white p-4 font-bold text-center">C</div>
<div class="bg-indigo-500 text-white p-4 font-bold text-center">D</div>
<div class="bg-indigo-500 text-white p-4 font-bold text-center">E</div>
</div>
</div>

Preview

A
B
C
D
E

How to Use

Add the Grid-cols-2 class directly to your HTML element:

html
<div class="Grid-cols-2">
<!-- Your content here -->
</div>

Responsive Usage

Use Tailwind's responsive prefixes to apply Grid-cols-2 at specific breakpoints:

html
<div class="sm:Grid-cols-2 md:Grid-cols-2 lg:Grid-cols-2">
Responsive element
</div>
  • sm:Grid-cols-2 — applies from 640px and up
  • md:Grid-cols-2 — applies from 768px and up
  • lg:Grid-cols-2 — applies from 1024px and up

Customization

You can extend or override this utility in your tailwind.config.js. See the Tailwind CSS documentation for details on customizing your theme.

Windframe is an AI visual editor for rapidly building stunning web UIs & websites

Start building stunning web UIs & websites!

Build from scratch or select prebuilt tailwind templates