1.使用弹性盒的方式实现不定宽高的元素在屏幕窗口水平垂直都居中,方法如下:

html,body{
    height: 100%;
}
body{
    display: flex;
    juastify-content: center;
    align-items: center;
}

2.使用弹性盒的方式实现不定宽高元素在父元素水平都垂直居中,方法如下:

父元素{
    display: flex;
    justify-content: center;
    align-itens: center;
}