Vertically center element with Bootstrap 3

2019-07-20 18:47发布

I would like to vertically center 'design' label as well as '21nov'.

<div class="row">             
     <div class="col-xs-6 col-xs-offset-1">                
         <a href="/job/52"><span class="jobtitle">designer</span></a>
         <span class="companyname"> @Subiaco</span>
         <div class="salary">90.000$ - 100.000$</div>
     </div>
     <div class="col-xs-3">   
        <span class="label label-success">design</span>                         
     </div>                         
    <div class="col-xs-2">                   
      21 nov.
    </div>                 
</div>

Current design : http://jsfiddle.net/8FM3n/

enter image description here


Expected design: enter image description here

Any hint ?

1条回答
啃猪蹄的小仙女
2楼-- · 2019-07-20 19:51

Assuming it isn't dynamic content of varying heights, you can use line-height.

.row .col-xs-3, .row .col-xs-2 {
    line-height: 49px;
}

jsFiddle example - it's vertically aligned now, though you might want to apply the styling to a different class so it won't affect other row elements.

查看更多
登录 后发表回答