css实现立体书本鼠标悬停立起来悬浮空中阴影效果代码

代码语言:html

所属分类:悬停

代码描述:css实现立体书本鼠标悬停立起来悬浮空中阴影效果代码

代码标签: css 立体 书本 鼠标 悬停 立起来 悬浮 空中 阴影

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100;400&display=swap");
* {
  box-sizing: border-box;
}

.sandbox {
  position: absolute;
  background-color: #f1f1f1;
  inset: 0;
  max-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: roboto, sans-serif;
  perspective: 3000px;
  perspective-origin: 500px -500px;
}
.sandbox.go-up .shadow {
  filter: blur(5px);
  background: -webkit-linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0%, rgba(208, 208, 208, 0) 100%);
  transform: translatey(175px) rotateY(40deg) translatez(-210px) rotatex(90deg);
  animation: hover-shadow 2s ease-in-out infinite 2s alternate;
}
@keyframes hover-shadow {
  0% {
    filter: blur(5px) opacity(1);
    transform: translatey(175px) rotateY(40deg) translatez(-210px) rotatex(90deg);
  }
  100% {
    filter: blur(8px) opacity(0.5);
    transform: translatey(175px) rotateY(40deg) translatez(-225px) rotatex(90deg);
  }
}

.card {
  cursor: pointer;
  position: relative;
  background-color: #fff;
  width: 300px;
  height: 350px;
  transform: translatey(50%) translatez(-150px) rotatey(40deg) rotatex(90deg);
  transition: transform 2s;
  transform-style: preserve-3d;
}
.card:hover {
  animation: hover-card 2s ease-in-out infinite 2s alternate;
  transform: translatey(-10%) rotatey(40deg);
}
@keyframes hover-card {
  0% {
    transform: translatey(-10%) rotatey(40deg);
  }
  100% {
    transform: translatey(-15%) rotatey(40deg);
  }
}
.card .face-left {
  position: absolute;
  background-color: #7D7D7D50;
  top: 0;
  left: 0;
  width: 30px;
  height: 100%;
  transform: translatex(-15px) translatez(-15px) rotatey(90deg);
}
.card .face-back {
  position: absolute;
  background-color: #D3D3D350;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: translatez(-30px);
}
.card .face-top {
  position: absolute;
  background-color: #D3D3D350;
  top: 0;
  width: 100%;
  height: 30px;
  transform: transl.........完整代码请登录后点击上方下载按钮下载查看

网友评论0