I am looking for Twitter Bootstrap examples and do not understand how all elements in this example are centered? Using what tag or style?
asked Apr 9, 2014 at 19:05
Bob
10.9k25 gold badges67 silver badges72 bronze badges
2 Answers 2
It is because .container div is centered using auto margins.
.container {
margin-right: auto;
margin-left: auto;
}
Also .jumbotron has
text-align: center;
attribute which centers the the child 'Sign up' button.
answered Apr 9, 2014 at 19:08
Aristona
9,56110 gold badges59 silver badges82 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Check out the helper classes in bootstrap here
Center content blocks Set an element to display: block and center via margin. Available as a mixin and class.
<div class="center-block">...</div>
// Classes
.center-block {
display: block;
margin-left: auto;
margin-right: auto;
}
// Usage as mixins
.element {
.center-block();
}
answered Apr 9, 2014 at 19:38
DivineChef
1,2011 gold badge10 silver badges29 bronze badges
Comments
lang-html