让一个元素水平垂直居中

设置该元素的定位方式为absolute,同时将上下左右的位置大小都设置为0,margin设置为auto,如下图所示:

原文地址:https://www.cnblogs.com/NIFS/p/12963815.html