vertical-align with Bootstrap 3

后端 未结 25 2511
庸人自扰
庸人自扰 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:53

    I genuinely find the following code works using Chrome and not other browsers than the currently selected answer:

    .v-center {
        display:table!important; height:125px;
    }
    
    .v-center div[class*='col-'] {
       display: table-cell!important;
       vertical-align:middle;
       float:none;
    }
    .v-center img {
       max-height:125px;
    }
    

    Bootply Link

    You may need to amend the heights (specifically on .v-center) and remove/change div on div[class*='col-'] for your needs.

提交回复
热议问题