VOOZH about

URL: https://www.geeksforgeeks.org/bootstrap/bootstrap-5-flex-justify-content/

⇱ Bootstrap 5 Flex Justify Content - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 Flex Justify Content

Last Updated : 10 Apr, 2024

Bootstrap 5 Flex Justify Content aligns items along the main axis, distributing space between or around them, facilitating flexible layouts and responsive design with various alignment options.

Bootstrap 5 Flex Justify Content Classes:

ClassDescription
justify-content-startAligns items to the start of the main axis for all screen sizes.
justify-content-endAligns items to the end of the main axis for all screen sizes.
justify-content-centerAligns items to the center of the main axis for all screen sizes.
justify-content-betweenAligns items between the start and end of the main axis for all screen sizes.
justify-content-aroundAligns items evenly spaced around the main axis for all screen sizes.
justify-content-evenlyAligns items evenly on the main axis for all screen sizes.

Syntax: The * can be replaceable with start, end, center, between, around and evenly.

<div class="d-flex justify-content-*">
 ...
</div>

Examples of Bootstrap 5 Flex Justify Content

Example 1: In this example, we change the alignment of the elements on the main axis using justify-content-start and justify-content-end classes.

Output:

👁 Image
Bootstrap 5 Flex Justify content

Example 2:  In this example, we change the alignment of the elements on the main axis using justify-content-center and justify-content-end classes.

Output:

👁 Image
Bootstrap 5 Flex Justify content
Comment

Explore