The layout of the two elements in the css div is about. How to center them vertically?

Center question

divdiv
:::flex

Mar.24,2021

1. Scheme 1

display:inline;
line-height=height

2. Option 2

position:absolute;
top:50%;
translate:transform(0,-50%)

flex layout:

.parent: {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

I. parent element flex scheme:

display:-webkit-box;
-webkit-box-align:center;
display:box;
box-align:center;
display:-webkit-flex;
display:flex;
align-items:center;

II. Parent element display:table scheme.
Center element is in the element of display:table-cell, and set vertical-align:center

III. Css3 scheme.
absolute positioning of central elements

position:absulote;
top:50%;
transform:translateY(-50%);

just use flex-box. In these days, you have to consider compatibility. Where can you find so many people using old systems?


give a reference, horizontal and vertical center

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e496d3-43a5c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e496d3-43a5c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?