vertical-align with Bootstrap 3

后端 未结 25 2512
庸人自扰
庸人自扰 2020-11-21 05:34

I\'m using Twitter Bootstrap 3, and I have problems when I want to align vertically two div, for example — JSFiddle link:

25条回答
  •  忘掉有多难
    2020-11-21 05:49

    Following the accepted answer, if you do not wish to customize the markup, for separation of concerns or simply because you use a CMS, the following solution works fine:

    .valign {
      font-size: 0;
    }
    
    .valign > [class*="col"] {
      display: inline-block;
      float: none;
      font-size: 14px;
      font-size: 1rem;
      vertical-align: middle;
    }
    
    
    Big
    Small

    The limitation here is that you cannot inherit font size from the parent element because the row sets the font size to 0 in order to remove white space.

提交回复
热议问题