Bootstrap 3 / CSS: How to properly vertically align in panel heading

╄→гoц情女王★ 提交于 2019-12-04 07:46:25

DEMO: http://jsbin.com/yowis/2/edit

<div class="panel-heading clearfix">

This will clear the float issue. That's what the issue is.

If you want both the text and the image:

<div class="panel-heading clearfix">

and the CSS is:

.panel-heading {line-height:32px;}

If you don't want to add clearfix, put this anywhere in your css:

.panel-heading:before {
  content: " ";
  display: table;
}
.panel-heading:after {
  clear: both;
}

I have a working fiddle of this and can't find your issue. Could you look over this and check the result is what you intended please.

I've only copied out the code from Bootstrap documentation in order to get this far, but am struggling to see if the issue is resolved as I'm not sure how to replicate your problem.

Visit http://jsfiddle.net/showcaseimagery/jbvbojy0/

html

<div class="panel panel-primary">
    <div class="panel-heading">
        Categories
        <span class="pull-right"><a href="#"><img src="http://placehold.it/32x32"></a></span>
    </div>
    <div class="panel-body">
        this is panel body
    </div>
</div>

css

 img {
    height:32px;
    width:32px;
    margin-top:-7px;
  }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!