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

代码语言:html

所属分类:布局界面

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

代码标签: css div 翻书 翻页

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

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

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

  
  
  
<style>

* {
  box-sizing: border-box;
  --bookWidth: 200px;
  --bookHeight: 200px;
}

body {
  background: #222;
  color: #eee;
  font-family: sans-serif;
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.book {
  display: flex;
}

.pages {
  width: var(--bookWidth);
  height: var(--bookHeight);
  position: relative;
  perspective: 2000px;
}
.pages input[type=checkbox] {
  display: none;
}

.page {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: left;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition: 1.5s;
  background: #f0f0f0;
  color: #999;
}
.page .front, .page .back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.page .front {
  padding: 0 16px;
  box-shadow: inset 16px 0 40px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.5);
}
.page .back {
  z-index: 9;
  transform: rotateY(180deg);
  backface-visibility: hidden;
  background-color: #666;
}
.page label {
  position: absolute;
  bottom: 0;
  padding: 4px;
  cursor: pointer;
  z-index: 1;
}
.page label.prev {
  right: 0;
}
.page label.next {
  right: 0;
}
.page img {
  max-width: 100%;
  height: auto;
}

#p1 {
  z-index: 3;
}

#p2 {
  z-index: 2;
}

#p3 {
  z-index: 1;
}

/**/
#c1:checked ~ #p1 {
  transform: rotateY(-180deg);
  z-index: 1;
}

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

#c3:checked ~ #p3 {
  transform: rotateY(-180deg);
  z-index: 3;
}

#ppg {
  /* z-index: length($pages);*/
}

#ppg {
  /* z-index: length($pages);*/
}

#ppg {
  /* z-index: length($pages);*/
}
</style>


  
  
</head>

<body translate="no">
  <div class="container">
  <div class="book">
    <img src="//repo.bfw.wiki/bfwrepo/image/651b7025b52b8.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_200,h_200,/quality,q_90" />
    <div class="pages">
   .........完整代码请登录后点击上方下载按钮下载查看

网友评论0