div+css实现4种文本特效效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现4种文本特效效果代码,包含阴影、断开、glitch、slan效果

代码标签: div css 文本 特效

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

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

<head>
  <meta charset="UTF-8">
  
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/normalize.5.0.css">
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Mochiy+Pop+P+One&display=swap");
main {
  font-family: "Mochiy Pop P One", sans-serif;
  max-height: 100vh;
  overflow-y: scroll;
  position: relative;
  display: flex;
  flex-direction: column;
}

.scroll {
  position: fixed;
  top: 20px;
  right: 40px;
  z-index: 1;
}

section {
  min-height: 100vh;
  font-size: calc(1rem + 20vmin);
  display: grid;
  place-content: center;
  overflow: hidden;
  perspective: 1000px;
  scroll-snap-align: start;
}

.glitch {
  background-color: #e88565;
}
.glitch p {
  position: relative;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 2px;
}
.glitch p::before {
  content: attr(data-attr);
  position: absolute;
  left: -3px;
  bottom: -8px;
  color: rgba(17, 35, 120, 0.5);
  text-shadow: -5px 0 rgba(17, 35, 120, 0.5);
  overflow: hidden;
  z-index: -1;
  clip: rect(0px, 9999px, 110px, 0);
}
.glitch p::after {
  content: attr(data-attr);
  position: absolute;
  left: 4px;
  bottom: 8px;
  color: rgba(204, 0, 0, 0.5);
  text-shadow: -5px 0 rgba(204, 0, 0, 0.25);
  overflow: hidden;
  z-index: 1;
  clip: rect(55px, 9999px, 200px, 0);
}

.slam {
  background-color: #055a5b;
  color: #e6e6e6;
}
.slam p {
  -webkit-animation: slam 5s infinite;
          animation: slam 5s infinite;
}

@-webkit-keyframes slam {
  50% {
    transform: translateY(-50px);
  }
  55% {
    transform: translateY(0);
  }
  60% {
    transform: translateY(-5px);
  }
  65% {
    transform: translateY(0);
  }
}

@keyframes slam {
  50% {
    transform: translateY(-50px);
  }
  55% {
    transform: translateY(0);
  }
  60% {
    transform: translateY(-5px);
  }
  65% {
    transform: .........完整代码请登录后点击上方下载按钮下载查看

网友评论0