<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
padding: 0;
margin: 0;
}
#container{
width: 800px;
height: 300px;
margin: 0 auto;
background-color: wheat;
}
.picbox{
width: 20%;
height: 40%;
float: left;
margin: 20px;
border-radius: 20px;
box-shadow: 0 0 3px #000;
position: relative;
transform-style: preserve-3d;
transition: 2s;
background-color: turquoise;
}
.picbox:hover{
transform: rotateY(180deg);
}
.face{
width: 100%;
height: 100%;
border-radius: 20px;
}
.front{
position: absolute;
background-color: yellow;
}
.front img{
border-radius: 20px;
width: 100%;
height: 100%;
}
.back{
transform: rotateY(180deg);
background-color: yellowgreen;
}
.back h3{
color: white;
text-align: center;
}
</style>
</head>
<body>
<div id='container'>
<div class="picbox">
<div class="face front"><img src="./1.jpg" alt=""></div>
<div class="face back">
<h3>咖啡</h3>
</div>
</div>
<div class="picbox">
<div class="face front"><img src="./2.jpg" alt=""></div>
<div class="face back">
<h3>咖啡</h3>
</div>
</div>
<div class="picbox">
<div class="face front"><img src="./3.jpg" alt=""></div>
<div class="face back">
<h3>咖啡</h3>
</div>
</div>
<div class="picbox">
<div class="face front"><img src="./4.jpg" alt=""></div>
<div class="face back">
<h3>咖啡</h3>
</div>
</div>
</div>
</body>
</html>
舞台{
父容器{
transform-style:3D
正面(position:absolute);
反面(旋转180度);
}
}
2554

被折叠的 条评论
为什么被折叠?



