两行css代码实现居中元素

  display: grid;
    /* 垂直居中 align-items: center;
    justify-content: center; */
    /* 垂直居中 place-items: center;*/
    /* 左上角 place-items: start; */
    /* 右上角 place-items: start end;*/
    /* 左下角 place-items: end start; */
    /* 右下角 place-items: end; */
    /* 居中靠上对齐 place-items: start center; */
    /* 居中靠下对齐 place-items: end center; */
    /* 居中靠左对齐 place-items: center start; */
    /* 居中靠右对齐 place-items: center end; */
    place-items: center;
    height: 100vh;
原文地址:https://www.cnblogs.com/wenshaochang123/p/14807271.html