How to center content in a Bootstrap column with HTML?

Spread the love

Sometimes, we want to center content in a Bootstrap column with HTML.

In this article, we’ll look at how to center content in a Bootstrap column with HTML.

How to center content in a Bootstrap column with HTML?

To center content in a Bootstrap column with HTML, we use its flexbox classes.

For instance, we write

<div class="d-flex justify-content-center">
  <div>some content</div>
</div>

to add the d-flex class to make the outer div a flex container.

Then we use justify-content-center to center its contents horizontally.

Conclusion

To center content in a Bootstrap column with HTML, we use its flexbox classes.

Leave a Reply

Your email address will not be published. Required fields are marked *