Flexbox की Utilities
Flex utilities एक element को एक flexible row या column में बदलती हैं और alignment और spacing control करती हैं।
In this page:
Syntax
<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
<!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. #}
आम गलतियां
- d-flex भूल जाना
- justify और align mix up करना
- यह उम्मीद करना कि 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: