Centering subhead in BS4
I've styled subhead with margin: auto but it's not working. What seems to be interfering?
I've styled subhead with margin: auto but it's not working. What seems to be interfering?
Hi, OP here. I am trying to learn how to code properly and have spent a fair amount of time reading Bootstrap info, primarily in w3schools. But I'm not an IT professional. I thought I had created a fairly limited number of overrides in my css file and would be happy to eliminate the redundancies.
That said, my objective here has simply to have the h5 in question centered while styled in reverse print with the custom subhead class. The initial response lead me to question whether the other headings at the top needed more than the text-center class to be correct.
The initial response lead me to question whether the other headings at the top needed more than the text-center class to be correct.
The headings at the top of your page are correct using the Bootstrap 'text-center' class applied to them. However you can't use 'text-center' with the heading 'Christmas/Holiday Songs' as you needed a solid background behind the text which only stretches the width of the text itself. If you had used 'text-center' that brown background would have stretched the width of its parent container.
One way to avoid that was putting the <h5></h5> heading in a Bootstrap row container and then applying the Bootstrap class 'mx-auto' to the <h5> tag, which forces an equal margin either side of the heading. Other ways are possible.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.