I have some problem to center p inside a div.
I need some help!
Thank you very much!
Here is my code:
<div class="navbar d-flex flex-grow-1 justify-content-end align-items-end mb-3 d-none d-sm-flex">
<div class="d-flex align-items-center justify-content-center text-white me-2 fw-bold">
<p>THIS NEEDS TO BE CENTERED</p>
</div>
<a type="button" class="btn btn-gold" href="">Booking!</a>
</div>
2
Answers
You can center a p tag using multiple methods in bootstrap.
This is how you can center it with
text-center
according to the DocumentationAlso if you want to center the paragraph vertically, you can use the
d-flex
andalign-items-center
classes. Here is an example:You can use the
text-center
class for its parent div. if you only need to center<p>
placetext-center
class inside it.Read more:
https://getbootstrap.com/docs/5.0/utilities/text/