Bootstrap面板标题,带有垂直中间字符/图标

时间:2017-03-09 19:59:35

标签: css twitter-bootstrap-3

如何在小型设备(<600px宽度)上显示时,x位于垂直中间位置?

<div class="row">
  <div class="col-sm-12">
    <section class="panel panel-default panel-slider"><div class="panel-heading">
      <h1 class="panel-title" style="font-size:18px">
           Test with long description in title panel bla bla<a class="align-middle more pull-right" href="https://example.com" title="" data-toggle="tooltip" data-placement="right" data-original-title="more" ><i>x</i></a>
      </h1>
</div>
 <div class="panel-body">
      <div class="row">
           <div class="col-xs-12 col-sm-12 col-md-8" style="margin-bottom: 10px;">
           ...
      </div>
</div>

目前是:

enter image description here

应该是:

enter image description here

https://jsfiddle.net/9dtu4en1/

提前致谢!

亲切的问候 亚历

1 个答案:

答案 0 :(得分:1)

我会在h1上使用flexbox进行更流畅的调整,并移除align-middle&amp;来自pull-right的{​​{1}}(以避免漂浮会使其父母不考虑孩子的身高):

<强> External Fiddle to resize

enter image description here

enter image description here

enter image description here

段:

a
h1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}