It is my first Twitter Bootstrap experience. I have added some headings (h1, h2, etc.) and they are aligned by left side. What is the right way to center headings?
In the current version of bootstrap 5.2. 0 it is: text-center, (center) text-end, (right) text-start, (left).
Add text-align: center in your CSS or text-center class to your parent element (probably to a row or container ).
Add class . text-center to the parent div to align text or any item inside to the center. You can also decide how the alignment should look like on the specific screen sizes.
.text-left { text-align: left; } .text-right { text-align: right; } .text-center { text-align: center; }
bootstrap has added three css classes for text align.
Just use class='text-center'
in <h>
element for center heading:
<h2 class="text-center">sample center heading</h2>
Use class='text-left'
in <h>
element for left heading, and use class='text-right'
in <h>
element for right heading.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With