8.HTML+CSS——鼠标经过翻转图片特效
图片稍惊悚
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>图片翻转</title>
<link rel="stylesheet" href="css/5-31.css">
</head>
<body>
<div class="box">
<div class="front">
<img src="images/ct81.jpg" alt="">
</div>
<div class="back">
<img src="images/ct41.jpg" alt="">
</div>
</div>
</body>
</html>
css:
body {
perspective: 400px;
margin: 0;
padding: 0;
background-color: #1f4662;
}
.box {
position: relative;
width: 400px;
height: 400px;
margin: 100px auto;
transition: all .4s;
transform-style: preserve-3d;
}
.box:hover {
transform: rotateY(180deg);
}
.front, .back, img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
}
.front {
z-index: 1;
}
.back {
transform: rotateY(180deg);
}
不定时更