← Back to Bootstrap Course | Chapter 4: Colors & Spacing | Lesson 6 of 7

Gap की Utilities

Gap utilities हर child पर margins के बिना flex और grid containers के children space करती हैं।

In this page:

  1. Gap Utilities
Syntax
markup
<div class="d-flex gap-3">
  <div>item</div>
  <div>item</div>
</div>

Gap Utilities

एक .d-flex या .d-grid container पर, .gap-3 children के बीच equal space add करता है। एक direction के लिए .row-gap-* और .column-gap-* इस्तेमाल करें। Grid system में equivalent g-*, gx-*, और gy-* gutter classes हैं।

Note: gap सिर्फ flex और grid containers पर काम करता है।

उदाहरण: Gap utilities

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">
  <div class="d-flex gap-3 mb-3">
    <div class="bg-success text-white p-2">one</div><div class="bg-success text-white p-2">two</div><div class="bg-success text-white p-2">three</div>
  </div>
  <div class="d-flex flex-wrap column-gap-5 row-gap-1 border p-2">
    <span class="badge text-bg-secondary">a</span><span class="badge text-bg-secondary">b</span><span class="badge text-bg-secondary">c</span>
  </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. non-flex elements पर gap इस्तेमाल करना
  2. इसकी बजाय हर child में margins add करना
  3. gap को gutters से confuse करना
चैप्टर सारांश
  • gap-* flex और grid children space करता है
  • row-gap और column-gap एक axis control करते हैं
  • Grid gutters g-* इस्तेमाल करते हैं
  • per-child margins की ज़रूरत नहीं
🔒

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.