其他代码

CSS剪裁GIF背景图片动画特效

阿里云


这是一款 css 剪裁 GIF 背景图片动画特效。该特效利用 css 的 background-clip 技术,将 gif 图片剪裁为文字效果,非常炫酷。
HTML 结构

  1. <div class= "wrapper">
  2.   <div class= "text" data-text= "2020">2020</div>
  3. <div>
也想出现在这里?联系我们
创客主机

CSS 样式

  1. .wrapper{
  2.   background: #252854;
  3.   width: 100%;
  4.   height:500px;
  5.   border-radius: 5px;
  6.   position: relative;  
  7. }
  8. .text{
  9.   flex: 0 0 100%;
  10.   font-size: 14rem;
  11.   font-weight: 900;
  12.   color: #00000000;
  13.   text-align: center;
  14.   font-family: 'Lato', sans-serif;
  15.   position: absolute;
  16.   left: 50%;
  17.   top: 50%;
  18.   transform: translate(-50%, -50%);
  19.   border-bottom: 1px solid #d4d7ff;
  20.   border-top: 1px solid #d4d7ff;
  21.   background: url(./img/source.gif);
  22.   background-clip: text;
  23.   -webkit-background-clip: text;
  24. }
  25.  
  26.  .text:after{
  27.    content: attr(data-text);
  28.    -webkit-text-stroke: 1.5px #d4d7ff;
  29.    position: absolute;
  30.    left: 50%;
  31.    top: 50%;
  32.    transform: translate(-50%, -49%);
  33.    background: url(./img/source.gif);
  34.    background-clip: text;
  35.    -webkit-background-clip: text;
  36.    background-size: 43%;
  37.  
  38. }

Codepen 网址:https://codepen.io/TajShireen/pen/wvBmXVN

CSS 剪裁 GIF 背景图片动画特效

已有 472 人购买
  • z70s
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!