Vertical align text in block element

后端 未结 9 1004
盖世英雄少女心
盖世英雄少女心 2020-12-04 09:53

I know vertical alignment is always asked about, but I don\'t seem to be able to find a solution for this particular example. I\'d like the text centered within the element,

9条回答
  •  春和景丽
    2020-12-04 10:39

    DO NOT USE THE 4th solution from top if you are using ag-grid. It will fix the issue for aligning the element in middle but it might break the thing in ag-grid (for me i was not able to select checkbox after some row). Problem is not with the solution or ag-grid but somehow the combination is not good.

    DO NOT USE THIS SOLUTION FOR AG-GRID

    li a {
        width: 300px;
        height: 100px;
        margin: auto 0;
        display: inline-block;
        vertical-align: middle;
        background: red;  
    }
    
    li a:after {
        content:"";
        display: inline-block;
        width: 1px solid transparent;
        height: 100%;
        vertical-align: middle;
    }
    

提交回复
热议问题