<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style> * {
margin: 0;
padding: 0;
font-size: 12px;
font-family: Arial;
}
#box {
width: 600px;
height: 600px;
margin: 100px auto;
}
img {
width: 130px;
height: 180px;
}
#box ul li {
list-style-type: none;
float: left;
width: 130px;
position: relative;
margin-left: 10px;
margin-top: 10px;
}
a {
text-decoration: none;
display: block;
width: 80px;
height: 30px;
background-color: crimson;
}
#box .info {
width: 130px;
height: 180px;
background-color: rgba(0, 0, 0, 0.6);
position: absolute;
}
h2 {
color: white;
text-align: center;
padding-top: 40px;
}
#box .info p {
font-size: 10px;
color: white;
text-align: center;
width: 100px;
margin: 0 auto;
}
a {
margin: 0 auto;
display: block;
text-align: center;
line-height: 30px;
vertical-align: middle;
color: white;
}
/*1、定位移到画面之外*/
#box .info {
top: -180px;
-webkit-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
transition: all 0.4s ease;
}
#box ul li {
overflow: hidden;
}
#box ul li:hover .info {
top: 0px;
} </style>
</head>
<body>
<div id="box">
<ul>
<li>
<div class="info"><h2>大标题</h2> <br>
<p>我一直在寻找有你的世界在哪里</p> <br><br> <a href="#">开始游戏</a></div>
<img src="3.jpg"></li>
<li>
<div class="info"><h2>大标题</h2> <br>
<p>我一直在寻找有你的世界在哪里</p> <br><br> <a href="#">开始游戏</a></div>
<img src="3.jpg"></li>
<li>
<div class="info"><h2>大标题</h2> <br>
<p>我一直在寻找有你的世界在哪里</p> <br><br> <a href="#">开始游戏</a></div>
<img src="3.jpg"></li>
<li>
<div class="info"><h2>大标题</h2> <br>
<p>我一直在寻找有你的世界在哪里</p> <br><br> <a href="#">开始游戏</a></div>
<img src="3.jpg"></li>
<li>
<div class="info"><h2>大标题</h2> <br>
<p>我一直在寻找有你的世界在哪里</p> <br><br> <a href="#">开始游戏</a></div>
<img src="3.jpg"></li>
<li>
<div class="info"><h2>大标题</h2> <br>
<p>我一直在寻找有你的世界在哪里</p> <br><br> <a href="#">开始游戏</a></div>
<img src="3.jpg"></li>
<li>
<div class="info"><h2>大标题</h2> <br>
<p>我一直在寻找有你的世界在哪里</p> <br><br> <a href="#">开始游戏</a></div>
<img src="3.jpg"></li>
<li>
<div class="info"><h2>大标题</h2> <br>
<p>我一直在寻找有你的世界在哪里</p> <br><br> <a href="#">开始游戏</a></div>
<img src="3.jpg"></li>
</ul>
</div>
</body>
</html>
效果图如下: