How to use vertical align in bootstrap

后端 未结 8 2186
北恋
北恋 2020-11-29 22:29

Simple problem: How do I vertically align a col within a col using bootstrap? Example here (I want to vertically align child1a and child1b):

http://bootply.com/7366

8条回答
  •  孤街浪徒
    2020-11-29 22:49

    Maybe an old topic but if someone needs further help with this do the following for example (this puts the text in middle line of image if it has larger height then the text).

    HTML:

    img
    text

    CSS:

    .display-table{
        display: table;
        table-layout: fixed;
    }
    
    .display-cell{
        display: table-cell;
        vertical-align: middle;
        float: none;
    }
    

    The important thing that I missed out on was "float: none;" since it got float left from bootstrap col attributes.

    Cheers!

提交回复
热议问题