In Bootstrap 4, the justify-content
utility class is used to align items according to the main axis inside the flex-box containers. Here are a few of its properties:
justify-content-start
: Lists all items at the start of the flex-box container.
justify-content-end
: Lists all items at the end of the flex-box container.
justify-content-between
: Lists items in such a way that the first item appears at the beginning, the second item appears at the end, and the third or more items appear in the center of the flex-box container.
justify-content-center
: Lists all items at the center of the flex-box container.
justify-content-around
: Lists items in such a way that the first item appears at the beginning with some left margin, the second item appears at the end with some right margin, and the third or more items appear at the center of the flex-box container.
Lines 5–6: Link Bootstrap 4 with our layout.
Lines 11–24: d-flex
is used to create a flex-box container. We are using justify-content-start
to align the buttons at the start of the flex-box container.
Lines 28–41: Using justify-content-end
to align the buttons at the end of the flex-box container.
Lines 45–58: Using justify-content-center
to align the buttons at the center of the flex-box container.
Lines 62–75: Using justify-content-between
to align the buttons in such a way that the first button appears at the beginning, the second button appears at the end, and the third button appears in the center of the flex-box container.
Lines 79–92: Using justify-content-around
to align the buttons in such a way that the first button appears at the beginning with some left margin, the second button appears at the end with some right margin, and the third button appears at the center of the flex-box container.
Free Resources