当前位置:   article > 正文

一个2024年新年快乐的前端代码_新年快乐代码特效2024

新年快乐代码特效2024
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. #new-year-animation {
  6. position: relative;
  7. width: 600px;
  8. height: 400px;
  9. background-color: black;
  10. color: white;
  11. font-size: 40px;
  12. text-align: center;
  13. padding-top: 200px;
  14. }
  15. #new-year-animation span {
  16. position: absolute;
  17. animation: fly 2s linear infinite;
  18. }
  19. @keyframes fly {
  20. 0% { top: 0px; left: 0px; }
  21. 50% { top: -200px; left: 400px; }
  22. 100% { top: 0px; left: 800px; }
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <div id="new-year-animation">
  28. <span>H</span>
  29. <span>A</span>
  30. <span>P</span>
  31. <span>P</span>
  32. <span>Y</span>
  33. <span> </span>
  34. <span>N</span>
  35. <span>E</span>
  36. <span>W</span>
  37. <span> </span>
  38. <span>Y</span>
  39. <span>E</span>
  40. <span>A</span>
  41. <span>R</span>
  42. <span>!</span>
  43. </div>
  44. <script>
  45. function showAnimation() {
  46. let spans = document.querySelectorAll('#new-year-animation span');
  47. spans.forEach((span, index) => {
  48. setTimeout(() => {
  49. span.style.display = 'inline';
  50. }, index * 100);
  51. });
  52. }
  53. showAnimation();
  54. </script>
  55. </body>
  56. </html>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/96389
推荐阅读