css+div实现翻书翻页效果代码

代码语言:html

所属分类:其他

代码描述:css+div实现翻书翻页效果代码

代码标签: css div 翻书 翻页

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

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

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


  
  
<style>
body {
  display: flex;
 justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  padding: 0;
  background: linear-gradient(90deg, #fff 50%, #4a1010 50%);
}

input {
display: none;
  
}

img {
  max-width: 100%;
  object-fit: cover;
}

.book {
  display: flex;
}

.book img {
  width: 100%;
  height: 100%;
}

#cover {
  width: 250px;
  height: 400px;
}

.flip-book {
  width: 250px;
  height: 400px;
  position: relative;
  perspective: 1500px;
}

.flip {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  transform-origin: left;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition: 500ms;
  color: #000;
}

p {
  font-size: 14px;
  line-height: 24px;
}

.front {
  position: absolute;
  inset: 0;
  background-color: #fff;
  box-sizing: border-box;
  box-shadow: inset 20px 0 50px  rgba(0,0,0,0.5), 0 2px 5px rgba(0,0,0,0.5);
  padding: 0 13px;
}

.back {
  position: absolute;
  inset: 0;
  z-index: 9;
  backface-visibility: hidden;
  background-color: #000;
  transform: rotateY(180deg);
}

.back-btn,.next-btn {
  position: absolute;
  bottom: 13px;
  right: 13px;
  cursor:pointer;
}
.back-btn {
  color: #fff;
}

#p1 {
  z-index: 3;
}

#p2 {
  z-index: 2;
}

#p3 {
  z-index: 1;
}

#c1:checked ~ .flip-book #p1 {
  transform: rotateY(-180deg);
  z-index: 1;
}

#c2:checked ~ .flip-book #p2 {
  transform: rotateY(-180deg);
  z-index: 2;
}

#c3:checked ~ .flip-book #p3 {
  transform: rotateY(-180deg);
  z-index: 3;
}
</style>

  
  
</head>

<body translate="no">
  <div class="book">
  <input type="checkbox" id="c1" />
  <input type="checkbox" id="c2"/>
  &l.........完整代码请登录后点击上方下载按钮下载查看

网友评论0