Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to center a box on Twitter Bootstrap

I'm laying out a login screen, and on that screen will be just a box with LOGIN and PASSWORD. I need to centralize vertically and horizontally (like any traditional login screen).

How can I achieve this with Twitter Bootstrap?

Thanks!

like image 431
rizidoro Avatar asked May 24 '12 18:05

rizidoro


1 Answers

If you are using bootstrap grid, then you can offset your columns:

<div class="row">
  <div class="span6 offset3">
     Your content goes here
  </div>
</div>

See example here: http://twitter.github.com/bootstrap/scaffolding.html#gridSystem

Or you can just use CSS to simply center block element,

div.login-box{
  margin:0 auto;
  width: 720px;
}
like image 98
Johny Avatar answered Oct 16 '22 09:10

Johny