Initial bootstrap course

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?

+49
twitter bootstrap
Jun 22 2018-12-12T00:
source share
4 answers
.text-left { text-align: left; } .text-right { text-align: right; } .text-center { text-align: center; } 

bootstrap added three CSS classes to align text.

+91
Mar 01 '13 at 6:02
source share

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.

+21
May 22 '16 at 20:44
source share

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:

CSS

  h1, h2, h3, h4, h5, h6 { text-align: center; } 
+11
Jun 22 2018-12-12T00:
source share

Bootstrap comes with many pre-build classes, and one of them is class="text-left" . Call this class if necessary. :-)

+4
Oct 13 '16 at 13:01
source share



All Articles