How the text is vertically centered on the div of unknown height

I would like to ask, this kind of layout which is similar to the cell, the first two are fixed, and the contents in the back red box can be added. How can we make the front text center vertically?

Mar.09,2021

this is a classic problem of css. There are no particularly good methods in the original css, but there are some alternatives, such as setting line-height, or using table,. Here are many detailed methods https://stackoverflow.com/que.

.

but my suggestion is to use the new flex layout directly, which is easier to understand and easier to maintain. There is also a way to center using flex in the link above.


display:{ table-cell;
            vertical-align:middle}

flex layout can also add span to the font
you can see Ruan Yifeng flex layout

Menu