← Back to Bootstrap Course | Chapter 2: Grid System | Lesson 7 of 7

Auto-layout वाली Columns

Auto-layout columns खुद को अपने content से size करते हैं या बिना numbers चाहिए equally space share करते हैं।

In this page:

  1. Auto-Layout Columns
Syntax
markup
<div class="row">
  <div class="col">equal</div>
  <div class="col-6">fixed width</div>
  <div class="col">equal</div>
</div>

Auto-Layout Columns

Plain .col columns row को equally share करते हैं। एक column की width set करना, जैसे .col-6, बाकी को बचा हुआ share करा देता है। Variable-width content .col-auto या .col-md-auto जैसे breakpoint versions इस्तेमाल करता है। Gutters g-* classes से बदली जा सकती हैं।

Note: g-0 gutters हटाता है, g-4 इन्हें बड़ा बनाता है।

उदाहरण: Auto-layout columns

markup
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="p-3">
<div class="container text-center">
  <div class="row g-2 mb-2"><div class="col"><div class="bg-info-subtle p-2">1 of 3</div></div><div class="col"><div class="bg-info-subtle p-2">2 of 3</div></div><div class="col"><div class="bg-info-subtle p-2">3 of 3</div></div></div>
  <div class="row g-2"><div class="col"><div class="bg-warning-subtle p-2">fills</div></div><div class="col-6"><div class="bg-warning p-2">col-6</div></div><div class="col"><div class="bg-warning-subtle p-2">fills</div></div></div>
</div>
</body>
</html>
Live Example
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. ऐसी fixed widths mix करना जो overflow हों
  2. col-auto के साथ equal widths की उम्मीद करना
  3. gutter classes भूल जाना
चैप्टर सारांश
  • .col space equally share करता है
  • एक set width बाकियों को बचा हिस्सा share कराती है
  • col-auto content के हिसाब से size होता है
  • g-* gutters control करता है
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.