Bootstrap 4: heading won't align to center
See original GitHub issueHi, I’m starting to fix my css since I just updated our website’s bootstrap source code to version 4.
I’ve got an issue with regards to aligning the heading to center. I’ve tried the following options:
option 1:
#sectionname h2 {
text-align: center;
}
option 2:
#sectionname h2 {
text-align: center!important;
}
option 3: (the latest i’ve added)
<h2 class="text-center">How does it work?</h2>
still, it won’t work. I’ve shared a screen cap for reference.
Any help will be appreciated. Much love to bootstrap!
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Bootstrap center heading - Stack Overflow
It is my first Twitter Bootstrap experience. I have added some headings (h1, h2, etc.) and they are aligned by left side. What...
Read more >Text · Bootstrap v4.6
Documentation and examples for common text utilities to control alignment, wrapping, weight, and more.
Read more >CSS · Bootstrap
Rows must be placed within a .container (fixed-width) or .container-fluid (full-width) for proper alignment and padding. · Use rows to create horizontal groups ......
Read more >Text · Bootstrap v5.0
Easily realign text to components with text alignment classes. For start, end, and center alignment, responsive classes are available that use the same ......
Read more >Navs - Bootstrap
Change the horizontal alignment of your nav with flexbox utilities. By default, navs are left-aligned, but you can easily change them to center...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Since your screenshot shows that it is between
row
try usingmx-auto
Columns should be the only children elements of a row. Rows are flexbox, thus your heading is behaving as a flex item.