下方有完整的css,分享的力量来源于———>你的赞
*{
margin: 0;
padding: 0;
}
/* 图片居中第一种方法 */
.boxs{
width:100%;
height: 100vh;
/* position: relative; */
}
.imgs{
width: auto;
height: auto;
position: relative;
/* position: absolute; */
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
/* 图片居中第二种方法 */
/* .boxs{
width: 100vw;
height: 100vh;
display: table-cell;
vertical-align: middle;
text-align: center;
}
.imgs{
width: auto;
height: auto;
} */
/* 图片居中第三种方法 */
/* .boxs{
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.imgs{
width: auto;
height: auto;
} */
/* 图片居中第四种方法 */
/* .boxs{
width: 100vw;
height: 100vh;
position: relative;
}
.imgs{
width: auto;
height: auto;
position: absolute;
margin: auto;
left: 0;
top: 0;
right: 0;
bottom: 0;
} */
</style>