CSS「background-clip」を使って、背景画像をテキストで切り抜き』の(3)です。「background-clip:text」で、CSSアニメーションで動かす背景画像をテキストで切り抜きます。

サンプルのテキスト「WEB受注システム 百万石」にhoverすると、派手なイルミネーションのようなCSSアニメーションが発動します。

なお、(1)(2)と同様にweb-kitブラウザ用ですので、Safari、Google Chrom、Lunascape、Sleipnirなどでご覧下さい。

WEB受注システム
百万石

htmlソース

  1. <div id="upper">
  2. <p>WEB受注システム<br><span class="big">百万石</span></p>
  3. </div>

CSSソース

  1. div#upper p {
  2. background:url("images/toon4.png") repeat;
  3. background-size:45%;
  4. text-align: center;
  5. font-family: "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, Osaka, "MS Pゴシック", "MS PGothic", sans-serif;
  6. line-height: 1.4;
  7. font-weight:bold;
  8. font-size: 52px;
  9. font-weight: bold;
  10. -webkit-background-clip: text;
  11. color:rgba(55, 55, 55, 1);
  12. }
  13. div#upper p:hover{
  14. filter: invert(100%);
  15. -webkit-text-fill-color: transparent;
  16. animation: anime 1s infinite steps(8);
  17. }
  18. @keyframes anime {
  19. from{
  20. background-position: 0 0;
  21. filter: hue-rotate(10deg) ;
  22. filter: invert(100%);
  23. }
  24. to {
  25. background-position: -800px 100px;
  26. filter: hue-rotate(10deg) ;
  27. filter: invert(100%);
  28. }
  29. }

 

戻るボタン