用CSS写一本书
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style>
*{
margin: 0;
padding: 0;
}
body{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: rgb(250,250,250);
background-attachment: fixed;
background-size: cover;
}
.book{
position: relative;
top: 0;
width: 400px;
height: 600px;
background: #fff;
transform: rotate(-37.5deg) skewX(10deg);
box-shadow: -35px 35px 50px rgba(0,0,0,1);
transition: 0.5s;
}
.book:hover{
transform: rotate(-37.5deg) skewX(10deg) translate(20px, -20px);
box-shadow: -50px 50px 100px rgba(0,0,0,1);
}
.book:before{
content: '';
width: 30px;
height: 100%;
background: url(https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1588900098&di=b41905c683262ede66a811bc539d8368&src=http://hbimg.b0.upaiyun.com/6fc64b52819c57b640f8d385c87f20ef740e728612a9e-hI3dqx_fw658);
position: absolute;
top: 0;
left: 0;
transform: skewY(-45deg) translate(-30px,-15px);
box-shadow: inset -10px 0 20px rgba(0,0,0,0.2);
}
.book:after{
content: '';
width: 100%;
height: 30px;
background: #ccc;
position: absolute;
bottom: 0;
left: 0;
transform: skewX(-45deg) translate(15px,30px);
}
.book h2{
position: absolute;
bottom: 100px;
left: 35px;
font-size: 5em;
line-height: 1em;
color: #fff;
}
.book h2 span{
background: url(https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1588900098&di=b41905c683262ede66a811bc539d8368&src=http://hbimg.b0.upaiyun.com/6fc64b52819c57b640f8d385c87f20ef740e728612a9e-hI3dqx_fw658);
background-attachment: fixed;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.book .writer{
position: absolute;
bottom: 20px;
right: 20px;
color: #3262626;
font-size: 0.6em;
padding-top: 5px;
font-weight: 500;
border-top-left-radius: 1px soild #262626;
}
.book .writer i{
font-weight: 700;
}
.book .cover{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 70%;
background: url(https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1588900098&di=b41905c683262ede66a811bc539d8368&src=http://hbimg.b0.upaiyun.com/6fc64b52819c57b640f8d385c87f20ef740e728612a9e-hI3dqx_fw658);
background-size: cover;
}
</style>
</head>
<body>
<div class="book">
<div class="cover"></div>
<h2>Book</br><span>Mockup</span></h2>
<span class="writer">Designed By <i>Muhammad Irshad</i></span>
</div>
</body>
</html>
代码来源与视频:https://www.youtube.com/watch?v=Za7PiYZlc4I&feature=youtu.be