纯CSS3制作3D旋转照片
一、搭建项目的基本结构
Visual Studio Code编写body代码快捷键:
div.father>div.son$*8
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D旋转照片</title>
<style>
*{
margin: 0;
padding: 0;
}
:root,body{
height: 100%;
width: 100%;
background-color: black;
}
.father{
width: 300px;
height: 300px;
position: absolute;
left: calc(50% - 150px);
/* 水平居中 */
top: calc(50% - 150px);
/* 垂直居中 */
}
.father div{
width: 300px;
height: 300px;
position: absolute;
background-size: 300px 300px;
}
.son1{
background-image: url(img/1.jpg);
}
.son2{
background-image: url(img/2.jpg);
}
.son3{
background-image: url(img/3.jpg);
}
.son4{
background-image: url(img/4.jpg);
}
.son5{
background-image: url(img/5.jpg);
}
.son6{
background-image: url(img/6.jpg);
}
.son7{
background-image: url(img/7.jpg);
}
.son8{