Difference between d-flex and d-inline-flex in Bootstrap 4
Flexbox is mainly used to manage the responsive alignment of grid cells, navbars, and components. In Bootstrap 4, it has two main offshoots: d-flex and d-inline-flex.
The d-flex class is used to create a full-screen width flexbox container and convert the items into it. On the other hand, d-flex-inline class also creates a flexbox container, but its width is customized.
This concept is shown in the following illustration:
Code
Explanation
Lines 5–6: Link Bootstrap 4 with our layout.
Lines 8–10: Create a flexbox container using
d-flexclass. We also add padding and contextual classes.Lines 12–14: Create a flexbox container using
d-inline-flexclass. We also add padding and contextual classes.
Free Resources
Copyright ©2026 Educative, Inc. All rights reserved