How do you get centered content using Twitter Bootstrap?

Hoa picture Hoa · Feb 7, 2012 · Viewed 939.4k times · Source

I'm trying to follow a very basic example. Using the starter page and the grid system, I was hoping the following:

...would produce centered text.

However, it still appears on the far left. What am I doing wrong?

Answer

ScottS picture ScottS · Feb 7, 2012

This is for Text Centering (which is what the question was about)

For other types of content, see Flavien's answer.

Update: Bootstrap 2.3.0+ Answer

The original answer was for an early version of bootstrap. As of bootstrap 2.3.0, you can simply give the div the class .text-center.


Original Answer (pre 2.3.0)

You need to define one of the two classes, row or span12 with a text-align: center. See http://jsfiddle.net/xKSUH/ or http://jsfiddle.net/xKSUH/1/