Center aligns div horizontally using default bootstrap bootstrap CSS

I know how to center the horizontal alignment of a div in CSS. You need to make the width less than 100% and have an automatic margin on the left and right sides. I want to make this default Twitter Bootstrap style. I do not want to write extra CSS. Want to know if you can use the default style used by Twitter Bootstrap.

To set the width of the div, I use span* . But span* is float: left . Is there any class that can set the width of the div but won't add float: left ?

+6
source share
5 answers

To horizontally align a div using even-range styles (span2, span4, etc.), you need to use offset.

 <div class="offset3 span6"> ... </div> 
+9
source

Use the pagination-centered class inside a div like:

  <div class="row"> <div class="span12 pagination-centered"> <p> content</p> </div> </div> 
+3
source

The boot method for the content center seems to assign it class="center-block" : a link to the Dupstart 3 download page .

However, he will not work on a heading or paragraph. class="text-center" seems to work in these cases.

+2
source

If the element you want to align horizontally is an odd range (@JayGee) and you don’t want to write extra CSS (not even inline?), Then the answer should be: No, this is not possible. Otherwise, I would go to @JayGee's answer.

0
source

Based on @JayGee answer.

 <div class="row"> <div class="col-sm-offset-4 col-md-offset-4 col-lg-offset-4 col-sm-4 col-md-4 col-lg-4"> ... content here ... </div> </div> 
0
source

All Articles