利用纯css3实现的文字亮光特效的代码演示


  今天给大家分享一款纯css3实现的文字亮光特效。这款特效文字上一道亮光逐渐扫过文字。效果非常漂亮。一起看下效果:

  实现的代码。

  html代码:

XML/HTML Code复制内容到剪贴板
  1. <span class="shiny"><span class="inner-shiny">Shiny</span> </span>  

  css3代码:

CSS Code复制内容到剪贴板
  1. body   
  2. {   
  3.   background#111;   
  4. }   
  5.   
  6. .shiny   
  7. {   
  8.   color#F5C21B;   
  9.   background: -webkit-gradient(linear, left topleft bottombottom, from(#F5C21B), to(#D17000));   
  10.   -webkit-background-clip: text;   
  11.   -webkit-text-fill-colortransparent;   
  12.   display:block;   
  13.   width:610px;   
  14.   margin:auto;   
  15.   font-family"Source Sans Pro"sans-serif;   
  16.   font-size: 13em;   
  17.   font-weight: 900;   
  18.   positionrelative;   
  19.   text-transformuppercase;   
  20. }   
  21.   
  22. .shiny::before   
  23. {   
  24.     background-position: -180px;   
  25.     -webkit-animation: flare 5s infinite;   
  26.   -webkit-animation-timing-function: linear;   
  27.   background-image: linear-gradient(65deg, transparent 20%, rgba(255, 255, 255, 0.2) 20%, rgba(255, 255, 255, 0.3) 27%, transparent 27%, transparent 100%);   
  28.   -webkit-background-clip: text;   
  29.   -webkit-text-fill-colortransparent;   
  30.   content"Shiny";   
  31.   color#FFF;   
  32.   displayblock;   
  33.   padding-right140px;   
  34.   positionabsolute;   
  35. }   
  36.   
  37. .shiny::after   
  38. {   
  39.   content"Shiny";   
  40.   color#FFF;   
  41.   displayblock;   
  42.   positionabsolute;   
  43.   text-shadow: 0 1px #6E4414, 0 2px #6E4414, 0 3px #6E4414, 0 4px #6E4414, 0 5px #6E4414, 0 6px #6E4414, 0 7px #6E4414, 0 8px #6E4414, 0 9px #6E4414, 0 10px #6E4414;   
  44.   top: 0;   
  45.   z-index: -1;   
  46. }   
  47.   
  48. .inner-shiny::after, .inner-shiny::before   
  49. {   
  50.         -webkit-animation: sparkle 5s infinite;   
  51.   -webkit-animation-timing-function: linear;   
  52.     background#FFF;   
  53.   border-radius: 100%;   
  54.   box-shadow: 0 0 5px #FFF, 0 0 10px #FFF, 0 0 15px #FFF, 0 0 20px #FFF, 0 0 25px #FFF, 0 0 30px #FFF, 0 0 35px #FFF;   
  55.   content"";   
  56.   displayblock;   
  57.   height10px;   
  58.   opacity: 0.7;   
  59.   positionabsolute;   
  60.   width10px;   
  61. }   
  62.   
  63. .inner-shiny::before   
  64. {   
  65.     -webkit-animation-delay: 0.2s;   
  66.   height7px;   
  67.   left: 0.12em;   
  68.   top: 0.8em;   
  69.   width7px;   
  70. }   
  71.   
  72. .inner-shiny::after   
  73. {   
  74.   top: 0.32em;   
  75.   rightright: -5px;   
  76. }   
  77.   
  78. @-webkit-keyframes flare   
  79. {   
  80.   0%   { background-position: -180px; }   
  81.   30%  { background-position500px; }   
  82.   100% { background-position500px; }   
  83. }   
  84.   
  85. @-webkit-keyframes sparkle   
  86. {   
  87.   0%   { opacity: 0; }   
  88.   30%  { opacity: 0; }   
  89.   40%  { opacity: 0.8; }   
  90.   60%  { opacity: 0; }   
  91.   100% { opacity: 0; }   
  92. }  

  以上就是css3实现的文字亮光特效的全部代码,制作起来很简单,看完以后希望大家能学习制作,谢谢阅读,希望能帮到大家,请继续关注phpstudy,我们会努力分享更多优秀的文章。


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3