css实现图片堆叠点击前后切换幻灯片效果代码

代码语言:html

所属分类:幻灯片

代码描述:css实现图片堆叠点击前后切换幻灯片效果代码

代码标签: 堆叠 切换 幻灯片 css

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


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

<head>

  <meta charset="UTF-8">
  

  
  
  
<style>
body {
  height: 100vh;
  margin-top: 4em;
}

h1 {
  text-align: center;
}

.container {
  max-width: 800px;
  margin: auto;
  display: flex;
  justify-content: center;
  margin-top: 2em;
  position: relative;
}

.cards {
  border-radius: 10px;
  box-shadow: 0px 0px 30px rgba(0, 0, 0, 0.2);
  position: absolute;
  width: 33.33%;
  transition: all 400ms ease;
  background-size: cover;
  background-position: center;
}
.cards:hover:not(.active).left {
  transform: translateX(-50%) rotate(-10deg) scale(0.9);
}
.cards:hover:not(.active).right {
  transform: translateX(50%) rotate(10deg) scale(0.9);
}
.cards.left {
  transform: translateX(-50%) scale(0.9);
}
.cards.right {
  transform: translateX(50%) scale(0.9);
}
.cards.active {
  z-index: 5;
  position: relative;
}
.cards__inner {
  position: relative;
  padding-bottom: 158.8235294118%;
}
</style>



</head>

<body>
  <h1>Shuffle Cards</h1>
<div class="container">
	<div class="cards" style="background-image: url('//repo.bfw.wiki/bfwrepo/image/61ac60be5ec44.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_200,h_500,/quality,q_90')">
		<div class="cards__inner"></div>
	&.........完整代码请登录后点击上方下载按钮下载查看

网友评论0