Center an element up, down, left, and right inside the parent element

1: Add text-align: center (center left and right) to the parent element
2: Add
display: inline-block;
vertical-align: middle; to
the current element 3: Behind the current element (don't return), add an empty span
Set the style for the span:
display: inline-block;
width: 0;
height: 100%;
vertical-align: middle;
**** or position: fixed; + margin: auto;

Guess you like

Origin www.cnblogs.com/msx-hanquan/p/12743724.html
Recommended