← Back to Bootstrap Course | Chapter 9: Layout Utilities | Lesson 1 of 7

Flexbox की Utilities

Flex utilities एक element को एक flexible row या column में बदलती हैं और alignment और spacing control करती हैं।

In this page:

  1. Flexbox Utilities
Syntax
markup
<div class="d-flex flex-row justify-content-between align-items-center">
  <div>item</div>
  <div>item</div>
</div>

Flexbox Utilities

एक flex container बनाने के लिए .d-flex add करें। Direction .flex-row या .flex-column से set होती है, main-axis alignment .justify-content-* से, cross-axis alignment .align-items-* से, और wrapping .flex-wrap से।

Children .flex-fill, .flex-grow-1, .align-self-*, और .ms-auto इस्तेमाल कर सकते हैं।

Note: justify-content main axis control करता है, align-items cross axis।

उदाहरण: Flexbox 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 justify-content-between align-items-center bg-light border p-2 mb-2">
    <span>Left</span><span>Centre-ish</span><span>Right</span>
  </div>
  <div class="d-flex flex-column align-items-end bg-light border p-2" style="height:8rem"><span>Item 1</span><span class="mt-auto">Pushed to bottom</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. d-flex भूल जाना
  2. justify और align mix up करना
  3. यह उम्मीद करना कि children पर flex utilities बिना एक container के काम करेंगी
चैप्टर सारांश
  • d-flex एक flex container बनाता है
  • flex-row और flex-column direction set करते हैं
  • justify-content-* और align-items-* align करते हैं
  • flex-wrap wrapping allow करता है
🔒

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.