div+css实现可爱互动按钮悬浮点击跳出卡通人效果代码

代码语言:html

所属分类:其他

代码描述:div+css实现可爱互动按钮悬浮点击跳出卡通人效果代码

代码标签: div css 可爱 互动 按钮 悬浮 点击 跳出 卡通人

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

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

<head>
  <meta charset="UTF-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1">


  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Acme&display=swap");
:root {
  font-family: "Acme", sans-serif;
}

body {
  background-image: radial-gradient(#e88420, #740b85);
  width: 100vw;
  height: 100vh;
  display: flex;
}

div {
  box-sizing: border-box;
}

#TrickOrTreat {
  margin: auto;
  position: relative;
}

.container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.head {
  width: 4.2rem;
  height: 4rem;
  position: relative;
}

.face {
  background-color: #f7d199;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  transform-style: preserve-3d;
  perspective: 1000px;
  border-radius: 99999px;
}
.face * {
  transform-style: preserve-3d;
}

.face-container {
  width: 100%;
  height: 100%;
  transform-origin: center center 2rem;
  transform: translateZ(2rem);
}

.eye {
  background-color: #000000;
  width: 0.4rem;
  height: 0.4rem;
  position: absolute;
  top: 2.2rem;
  border-radius: 99999px;
}
.eye.left {
  left: 1rem;
}
.eye.right {
  right: 1rem;
}
.eye::after {
  content: "";
  background-color: #ffffff;
  width: 0.09rem;
  height: 0.09rem;
  position: absolute;
  top: 0.09rem;
  left: 0.09rem;
  border-radius: 99999px;
}

.blush {
  background-color: #f79999;
  width: 1.2rem;
  height: 1.2rem;
  position: absolute;
  top: 2.7rem;
  border-radius: 99999px;
  filter: blur(4px);
}
.blush.left {
  left: 0.3rem;
}
.blush.right {
  right: 0.3rem;
}

.mouth {
  width: 0.9rem;
  height: 0.4rem;
  border: solid 0.125rem #000000;
  border-top: 0;
  position: absolute;
  top: 2.95rem;
  left: calc(50% - 0.45rem);
  border-radius: 0 0 99999px 99999px;
}

.hair {
  background-color: #000000;
  width: 4.6rem;
  height: 2.7rem;
  position: absolute;
  top: -0.9rem;
  left: calc(50% - 2.3rem);
  border-radius: 99999px 99999px 0 0;
}

.hair-1 {
  background-color: #000000;
  width: 2.5rem;
  height: 2.5rem;
  position: absolute;
  top: 1.2rem;
}
.hair-1.left {
  left: -1.75rem;
  border-radius: 50% 50% 50% 0;
  transform: skew(-15deg) rotate(-25deg);
}
.hair-1.right {
  right: -1.75rem;
  border-radius: 50% 50% 0 50%;
  transform: skew(15deg) rotate(25deg);
}

.hat {
  position: absolute;
  top: 0;
  left: 50%;
}
.hat .hat-top {
  background-image: linear-gradient(45deg, transparent 0% 50%, #8d65c9 50% 100%);
  width: 3.8rem;
  height: 3.8rem;
  overflow: hidden;
  position: absolute;
  top: -1.75rem;
  left: calc(50% - 1.9rem);
  transform: rotate(-55deg) skew(-20deg);
}
.hat .hat-top .hat-ribbon {
  background-color: #d14949;
  width: 5rem;
  height: 0.75rem;
  position: absolute;
  top: calc(calc(50% - 0.375rem) - 0.5rem);
  left: calc(calc(50% - 2.5rem) + 0.5rem);
  border-radius: 50% 50% 0% 0%/100% 100% 0% 0%;
  transform: rotate(43.75deg);
}
.hat .hat-bottom {
  background-color: #8d65c9;
  width: 6.75rem;
  height: 1.75rem;
  position: absolute;
  top: -0.5rem;
  left: calc(50% - 3.375rem);
  border-radius: 50% 50% 25% 25%/.........完整代码请登录后点击上方下载按钮下载查看

网友评论0