Nearby lessons
32 of 39π BS5 Flex
π What Are Bootstrap 5 Flex Utilities?
Bootstrap provides flexbox utilities. Use .d-flex to create a flex container, then .flex-row / .flex-column, .justify-content-*, .align-items-*, .flex-wrap, and responsive variants (e.g. .flex-md-row).
π Flex Container (.d-flex, .d-inline-flex)
.d-flex β display: flex (block-level flex container). .d-inline-flex β inline flex container. Responsive: .d-md-flex, .d-lg-none, etc.
β‘οΈ Direction (.flex-row, .flex-column)
.flex-row β main axis horizontal (default). .flex-row-reverse β reverse order. .flex-column β main axis vertical. .flex-column-reverse. Responsive: .flex-md-column.
βοΈ Justify Content (.justify-content-*)
.justify-content-start β align items at the start. .justify-content-center β center. .justify-content-end β end. .justify-content-between β space between. .justify-content-around, .justify-content-evenly.
βοΈ Align Items (.align-items-*)
.align-items-start β align on cross-axis start. .align-items-center β center. .align-items-end β end. .align-items-stretch (default). Use on the flex container.
β Flex Best Practices
- Use .d-flex then .justify-content-* and .align-items-* for layout.
- Use .flex-column for vertical stacks.
- Use responsive classes: .flex-md-row, .justify-content-lg-between.