display: table for Vertical Centering in CSS


Before Flexbox and Grid, display: table was a trick used for vertical centering.

Source Code

.table {
    display: table;
    height: 100px;
}
.table-cell {
    display: table-cell;
    vertical-align: middle;
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments