amr*_*ree 55 css twitter-bootstrap
I've managed to place a button group at the far side of a header (H1/H2/H3). However, I don't know how to make the button float vertically in the middle. It just stays at the top. I tried using margin-top but since it's a fixed value it won't be dynamically placed in the middle.
Here's the screenshot:

Here's the code:
<div class="container">
<section>
<div class="page-header">
<h1 class="pull-left">
The header
</h1>
<div class="pull-right">
<div class="btn-group">
<button class="btn btn-primary">
Actions
</button>
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
<li>
<a href="#">Action</a>
</li>
<li>
<a href="#">Another Action</a>
</li>
</ul>
</div>
</div>
<div class="clearfix"></div>
</div>
Contents
</section>
</div>
Run Code Online (Sandbox Code Playgroud)
Thanks in advance.
jsFiddle: http://jsfiddle.net/aurorius/PKrUC/
joh*_*ino 166
这是如何在没有任何额外CSS的情况下在Bootstrap 3.2,3.3中获得与标题对齐的按钮,以防有人从谷歌来到这里.
选项1
<div class='page-header'>
<div class='btn-toolbar pull-right'>
<div class='btn-group'>
<button type='button' class='btn btn-primary'>Button Text</button>
</div>
</div>
<h2>Header Text</h2>
</div>
Run Code Online (Sandbox Code Playgroud)
如果您只使用一个按钮,则按钮组是可选的.
选项2
<h1>
<span>Header Text</span>
<button class='btn btn-primary pull-right'>Button Text</button>
</h1>
<hr/>
Run Code Online (Sandbox Code Playgroud)
试试这个css代码
.btn-group.my-class{
bottom: 15px;
position: relative;
top: 15px;
}
Run Code Online (Sandbox Code Playgroud)
H1/H2/H3上的动态标题可能是H4
演示:http://jsfiddle.net/PKrUC/2/