This is my first Twitter upload experience. I added a few headers (h1, h2, etc.), and they are aligned on the left side. What is the correct way to center the headers?
.text-left { text-align: left; } .text-right { text-align: right; } .text-center { text-align: center; }
bootstrap added three CSS classes to align text.
just use class = "text-center" in the element for the center header.
<h2 class="text-center">sample center heading</h2>
use class = "text-left" in the element for the left caption, and use class = "text-right" in the element for the right caption.
In your comments, to focus all the headers, all you have to do is add text-align:center to all of them at the same time:
text-align:center
CSS
h1, h2, h3, h4, h5, h6 { text-align: center; }
Bootstrap comes with many pre-build classes, and one of them is class="text-left" . Call this class if necessary. :-)
class="text-left"