Izgara Sütunlarını Tanımlama
grid-cols-1 ile grid-cols-12 arasında değerler kullanarak çok sütunlu düzenler oluşturun ve özel yapılandırmalar için grid-cols-none kullanın.
Izgara Sütunlarını Tanımlama, CoddyKit'te ücretsiz bir Tailwind CSS Academy dersidir. Bu, 4 dersinin 1. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Tailwind CSS Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Tailwind CSS Academy kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
CSS Grid in Tailwind
CSS Grid is a two-dimensional layout system that lets you place items in rows and columns simultaneously. Tailwind CSS provides utility classes that map directly to CSS Grid properties, so you never have to write display: grid or grid-template-columns by hand. You simply add the right class names to your HTML elements.
<div class="grid">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</div>Activating Grid Display
To turn an element into a grid container, apply the grid class. Without any column definition, all children stack into a single column by default. This is the starting point for any Tailwind Grid layout — every grid utility you add builds on top of the grid class.
<!-- Single-column grid by default -->
<div class="grid gap-4">
<div class="bg-blue-100 p-4">Card 1</div>
<div class="bg-blue-100 p-4">Card 2</div>
<div class="bg-blue-100 p-4">Card 3</div>
</div>The grid-cols-N Utilities
Tailwind provides grid-cols-1 through grid-cols-12 to divide the container into equal-width columns. Under the hood, grid-cols-3 compiles to grid-template-columns: repeat(3, minmax(0, 1fr)). This means all columns share the available width equally, making it perfect for card grids and feature sections.
<!-- 3-column equal grid -->
<div class="grid grid-cols-3 gap-4">
<div class="bg-green-100 p-4">Col 1</div>
<div class="bg-green-100 p-4">Col 2</div>
<div class="bg-green-100 p-4">Col 3</div>
<div class="bg-green-100 p-4">Col 4</div>
<div class="bg-green-100 p-4">Col 5</div>
<div class="bg-green-100 p-4">Col 6</div>
</div>Common Column Counts
Different column counts suit different use cases. A 2-column grid works well for split-content sections, 3 columns for feature rows, and 4 or 6 columns for product or image galleries. Tailwind supports every integer from 1 to 12, giving you the same range as Bootstrap's grid system but without the row wrappers.
<!-- 2-col layout -->
<div class="grid grid-cols-2 gap-6">
<div class="bg-purple-100 p-6">Left panel</div>
<div class="bg-purple-100 p-6">Right panel</div>
</div>
<!-- 4-col product grid -->
<div class="grid grid-cols-4 gap-4">
<div class="bg-yellow-100 p-4">Product</div>
<div class="bg-yellow-100 p-4">Product</div>
<div class="bg-yellow-100 p-4">Product</div>
<div class="bg-yellow-100 p-4">Product</div>
</div>The 12-Column Grid System
The 12-column grid is a classic design convention because 12 is divisible by 1, 2, 3, 4, and 6, giving you lots of layout flexibility. With Tailwind's grid-cols-12, each child occupies one column by default. You then use col-span-* on individual children to make them span multiple columns — which we will explore in the next lesson.
<!-- 12-column base -->
<div class="grid grid-cols-12 gap-2">
<!-- Each child spans 1 col unless told otherwise -->
<div class="bg-red-100 p-2">1</div>
<div class="bg-red-100 p-2">2</div>
<div class="bg-red-100 p-2">3</div>
<!-- ...up to 12 -->
</div>grid-cols-none for Custom Grids
When the predefined 1–12 presets are not enough, use grid-cols-none to remove any column template, then define your own with grid-cols-[...] arbitrary values. The bracket notation lets you write any valid CSS grid-template-columns value directly inside a class name, giving you infinite flexibility without leaving HTML.
<!-- Custom column widths with arbitrary values -->
<div class="grid grid-cols-[200px_1fr_2fr] gap-4">
<div class="bg-indigo-100 p-4">Fixed 200px</div>
<div class="bg-indigo-100 p-4">1 fraction</div>
<div class="bg-indigo-100 p-4">2 fractions</div>
</div>Subgrid With Tailwind
Modern browsers support the subgrid keyword, which lets a nested grid inherit its parent's column tracks. Tailwind v3.4+ includes grid-cols-subgrid for this purpose. Subgrid is powerful for aligning form labels inside card components that sit in a parent grid — each card's internal elements align with the overall grid lines.
<!-- Parent grid with 3 columns -->
<div class="grid grid-cols-3 gap-4">
<!-- Child that spans 2 cols and uses subgrid internally -->
<div class="col-span-2 grid grid-cols-subgrid gap-2">
<div class="bg-teal-100 p-3">A</div>
<div class="bg-teal-100 p-3">B</div>
</div>
<div class="bg-teal-200 p-3">C</div>
</div>Combining Grid With Gap
The gap-* utilities add consistent spacing between grid cells. Use gap-4 for uniform spacing in both directions, gap-x-4 for horizontal-only gaps, and gap-y-6 for vertical-only gaps. Unlike margins, gap does not add extra space on the outside edges of the grid, keeping your layout clean and predictable.
<!-- Different horizontal and vertical gaps -->
<div class="grid grid-cols-3 gap-x-8 gap-y-4">
<div class="bg-orange-100 p-4">A</div>
<div class="bg-orange-100 p-4">B</div>
<div class="bg-orange-100 p-4">C</div>
<div class="bg-orange-100 p-4">D</div>
<div class="bg-orange-100 p-4">E</div>
<div class="bg-orange-100 p-4">F</div>
</div>Responsive Column Definitions
In most real-world layouts you want fewer columns on small screens and more on larger ones. Tailwind's responsive prefixes make this trivial: grid-cols-1 md:grid-cols-2 lg:grid-cols-4 stacks items on mobile, shows two columns on tablets, and four on desktops. This mobile-first approach means the unprefixed class is the baseline, and prefixed classes override it at larger breakpoints.
<!-- Mobile: 1 col, tablet: 2 cols, desktop: 4 cols -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
<div class="bg-sky-100 p-6 rounded-lg">Card A</div>
<div class="bg-sky-100 p-6 rounded-lg">Card B</div>
<div class="bg-sky-100 p-6 rounded-lg">Card C</div>
<div class="bg-sky-100 p-6 rounded-lg">Card D</div>
</div>Auto-Fill vs Auto-Fit Columns
CSS Grid's auto-fill and auto-fit keywords create dynamic column counts based on available space. With Tailwind's arbitrary value syntax you can write grid-cols-[repeat(auto-fill,minmax(200px,1fr))] to automatically add columns as space allows. auto-fill keeps empty tracks, while auto-fit collapses them — both create truly fluid grids without media queries.
<!-- Auto-filling card grid: min 250px per card -->
<div class="grid gap-4" style="grid-template-columns: repeat(auto-fill, minmax(250px, 1fr))">
<div class="bg-pink-100 p-4 rounded">Card 1</div>
<div class="bg-pink-100 p-4 rounded">Card 2</div>
<div class="bg-pink-100 p-4 rounded">Card 3</div>
<div class="bg-pink-100 p-4 rounded">Card 4</div>
<div class="bg-pink-100 p-4 rounded">Card 5</div>
</div>Practical Three-Column Feature Grid
Putting it all together, here is a real feature section pattern used on marketing pages. Each feature card has an icon, heading, and description. The grid is grid-cols-1 sm:grid-cols-3 so it stacks on mobile and spreads into three columns on larger screens. Consistent padding and a subtle background create visual separation without borders.
<section class="grid grid-cols-1 sm:grid-cols-3 gap-8 px-8 py-12">
<div class="text-center">
<div class="text-4xl mb-4">🚀</div>
<h3 class="font-bold text-lg mb-2">Fast</h3>
<p class="text-gray-600">Ships in milliseconds.</p>
</div>
<div class="text-center">
<div class="text-4xl mb-4">🔒</div>
<h3 class="font-bold text-lg mb-2">Secure</h3>
<p class="text-gray-600">Built-in protection.</p>
</div>
<div class="text-center">
<div class="text-4xl mb-4">📱</div>
<h3 class="font-bold text-lg mb-2">Responsive</h3>
<p class="text-gray-600">Works on all devices.</p>
</div>
</section>Quick Check
Test your understanding of Tailwind CSS Mastery concepts from this lesson.
Lesson Recap
In this lesson you learned: the grid class activates a CSS Grid container, grid-cols-1 through grid-cols-12 define equal-width column tracks, and responsive prefixes like md:grid-cols-3 switch column counts at breakpoints. Next up we explore how to make grid items span multiple columns and rows for complex layouts.
Sıkça Sorulan Sorular
“Izgara Sütunlarını Tanımlama” dersi ücretsiz mi?
Evet — “Izgara Sütunlarını Tanımlama” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Tailwind CSS Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Tailwind CSS Academy kursu toplamda 4 dersten oluşur.
“Izgara Sütunlarını Tanımlama” dersinde ne öğreneceğim?
grid-cols-1 ile grid-cols-12 arasında değerler kullanarak çok sütunlu düzenler oluşturun ve özel yapılandırmalar için grid-cols-none kullanın. Tailwind CSS Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Tailwind CSS Academy öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Tailwind CSS Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 1. dersidir.
“Izgara Sütunlarını Tanımlama” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Tailwind CSS Academy dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Tailwind CSS Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Izgara Sütunlarını Tanımlama
- Sütun ve Satır Birleştirme
- Izgara Satırları ve Otomatik Yerleştirme
- Izgarada Boşluk, Gerekçelendirme ve Hizalama