The method of block-level elements horizontally and vertically centered css achieve?

Positioned opposite to the parent, the child to absolute positioning, margin is set to auto, and down around the value set to zero.

Positioned opposite to the parent, the child to absolute positioning, provided 50% and top left, then left, and upward movement of the negative half of a child.

Parent Set display: flex; justify-content: cneter; align-items: center;

Parent Set display: table-cell; vertical-align: middle; text-align: center; child setting display: inline-block;

Guess you like

Origin www.cnblogs.com/wuqilang/p/11366993.html