div+css实现扑克卡片堆叠悬浮放大弹出效果代码

代码语言:html

所属分类:悬停

代码描述:div+css实现扑克卡片堆叠悬浮放大弹出效果代码

代码标签: div css 扑克 卡片 堆叠 悬浮 放大 弹出

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

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

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


<style>
*, *::before, *::after {
 
font-family: inherit;
 
box-sizing: inherit;
 
margin: 0;
 
padding: 0;
}

html
{
 
box-sizing: border-box;
 
font-family: 'Nunito Sans', sans-serif;
 
font-size: 62.5%;
}

html body
{
 
font-size: 1.6rem;
 
margin: 0;
 
height: 100vh;
 
overflow: hidden;
 
display: flex;
 
flex-direction: column;
 
align-items: center;
 
justify-content: center;
}

ul
{
 
list-style: none;
}

a
, a:link, a:visited {
 
text-decoration: none;
}
</style>
 
 
 
<style>
body {
  background-image: linear-gradient(160deg, #777, #222);
}

.hands {
  --cards: 9;
  --curvature: 70deg;
  counter-reset: cards;
  position: absolute;
  bottom: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  transform: translateY(15vmin);
  transform-style: preserve-3d;
}
.hands > * {
  --hue: calc(360deg / var(--cards) * var(--index));
  --curve: calc(var(--curvature) * ((var(--index) - (var(--cards) - 1) / 2) / var(--cards)));
  position: absolute;
  counter-increment: cards;
  flex: 0 0 auto;
  width: 15vw;
  max-width: 20vh;
  aspect-ratio: 2/3;
  transform-origin: 50% 100%;
  transform: rotate(var(--curve)) translateY(-225%);
  transition: all 0.3s;
  position: absolute;
  cursor: pointer;
  font-size: 11vmin;
  transform-style: preserve-3d;
}
.hands > *::before {
  content: counter(cards);
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  color: hsl(var(--hue), 50%, 30%);
  font-weight: bold;
  width: 100%;
  height: 100%;
  border: solid 2px hsla(var(--hue), 50%, 40%, 1);
  background-image: linear-gradient(to bottom right, hsl(var(--hue), 50%, 66%), hsl(calc(var(--hue) - 45deg), 40%, 50%));
  transition: all 0.3s, translate 0s;
  box-shadow: 0px 4px 10px hsla(var(--hue), 80%, 80%, 0);
  border-radius: 4px;
  text-shadow: 0px 2px 0px rgba(0, 0, 0, 0.2);
  pointer-events:.........完整代码请登录后点击上方下载按钮下载查看

网友评论0