<!DOCTYPE html>
/*透明度设置的两种方式,以及hover的用法,fixed,(relative,absolute)这两个一起用*/
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.touch:hover .content{
visibility: visible;/*显示*/ }
.touch{
width: 200px;
height: 200px;
overflow: hidden;
position: relative;
}
.touch .content{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
color:white;
/*background-color: black;*/
/*opacity: 0.5;*/
background-color:rgba(0,0,0,.5);/*透明度设置的两种方式*/
text-align: center;
visibility: hidden;/* 隐藏*/
}
.touch .c1{
font-size: 32px;
}
</style>
</head>
<body>
<div class="touch">
<div><img src="1.jpg"></div>
<div class="content">
<div class="c1">ALEX</div>
<div>500-1000(日)</div>
</div>
</div>
</body>
</html>