MENU

CSS文件夹悬停交互效果,鼠标悬停

• October 17, 2020 • Read: 99 • 代码分享,经验分享,资源分享阅读设置

HTML

<div class="folder">
  <div class="folder__back">
    <div class="paper"></div>
    <div class="paper"></div>
    <div class="paper"></div>
    <div class="folder__front"></div>
    <div class="folder__front right"></div>
  </div>
</div>

CSS

body{
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100vh;
  background: #1f1f1f;
  display: flex;
  justify-content: center;
  align-items: center;
}

.folder {
  transition: all 0.2s ease-in;
}
.folder__back {
  position: relative;
  width: 100px;
  height: 80px;
  background: #4786ff;
  border-radius: 0px 5px 5px 5px;
}
.folder__back::after {
  position: absolute;
  bottom: 98%;
  left: 0;
  content: "";
  width: 30px;
  height: 10px;
  background: #4786ff;
  border-radius: 5px 5px 0 0;
}
.folder__back .paper {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translate(-50%, 10%);
  width: 70%;
  height: 80%;
  background: #e6e6e6;
  border-radius: 5px;
  transition: all 0.3s ease-in-out;
}
.folder__back .paper:nth-child(2) {
  background: #f2f2f2;
  width: 80%;
  height: 70%;
}
.folder__back .paper:nth-child(3) {
  background: white;
  width: 90%;
  height: 60%;
}
.folder__back .folder__front {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #70a1ff;
  border-radius: 5px;
  transform-origin: bottom;
  transition: all 0.3s ease-in-out;
}
.folder:hover {
  transform: translateY(-8px);
}
.folder:hover .paper {
  transform: translate(-50%, 0%);
}
.folder:hover .folder__front {
  transform: skew(15deg) scaleY(0.6);
}
.folder:hover .right {
  transform: skew(-15deg) scaleY(0.6);
}
Archives QR Code Tip
QR Code for this page
Tipping QR Code