方法一、自动适应居中
img {
display: block;
margin-left: auto;
margin-right: auto;
}
方法二、垂直居中
img {
position: absolute;
top: 0; bottom:0; left: 0; right:0;
margin: auto;
}
img {
display: block;
margin-left: auto;
margin-right: auto;
}
img {
position: absolute;
top: 0; bottom:0; left: 0; right:0;
margin: auto;
}
转载于:https://my.oschina.net/u/2308739/blog/464950