图片完美垂直居中的实现方法:display:table\table-row\table-cell

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Vertical-align</title>
<style type="text/css">
.container{
width: 300px;
height: 400px;
margin: 50px auto;
border: 1px solid #ccc;
display: table;
}
.img{
text-align: center;
vertical-align: middle;
display: table-cell;
}
img{
width: 260px;
height: 350px;
}
</style>
</head>
<body>
    <div class="container">
        <div class="img">
            <img src="your_image.jpg">
        </div>
    </div>
</body>
</html>