How to align 2 buttons in twitter bootstrap in one div

I am using twitter bootstrap 2 version.

<div class="span4">
    <a href="http://test.com" class="btn">&{'main.menu.with.me'}</a>            
    <a href="http://test2.com" class="btn btn-info pull-right">&{'main.menu.raise.request'}</a>
</div>

I need to put 2 buttons to the right with the space between them. But if I put my right hand on both, there is no space between them, I inject does not help.

+4
source share
3 answers

not very good in html, but I would do something like this:

bootstrap 2 :

<div class="span4">
 <div class='pull-right'>
   <a href="http://test.com" class="btn">&{'main.menu.with.me'}</a>         
   <a href="http://test2.com" class="btn btn-info">&{'main.menu.raise.request'}</a>
 </div>
</div>

in this case, you will need div.clearfix after it is pressed right and css is not involved if you do not want more space between the buttons, and then bootstrap already has it.

(08/08/2016 update) bootstrap 3 :

<div class='btn-toolbar'>
  <a href="http://test.com" class="btn">&{'main.menu.with.me'}</a>         
  <a href="http://test2.com" class="btn btn-info">&{'main.menu.raise.request'}</a>
</div>
+8
source

pull-right

the, :

.btn{
    margin-right:10px;
}

, , pull ing right ... ( )

+3
.span4 .btn {
    margin-left: 10px;
    margin-right: 10px;
}
0
source

All Articles