经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » HTML/CSS » CSS3 » 查看文章
CSS3.0实现霓虹灯按钮动画特效的示例代码_css3_CSS
来源:jb51  时间:2021/1/18 15:58:18  对本文有异议

今天给大家分享一个用CSS 3.0实现的霓虹灯按钮动画特效,效果如下:

以下是代码实现,欢迎大家复制粘贴和收藏。

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>CSS 3.0实现霓虹灯按钮动画特效</title>
  7. <style>
  8. * {
  9. font-family: '微软雅黑', sans-serif;
  10. box-sizing: border-box;
  11. }
  12. body {
  13. display: flex;
  14. align-items: center;
  15. justify-content: center;
  16. min-height: 100vh;
  17. background: #050801;
  18. }
  19. a {
  20. position: relative;
  21. display: inline-block;
  22. padding: 25px 30px;
  23. margin: 0 50px;
  24. color: #03e9f4;
  25. text-decoration: none;
  26. overflow: hidden;
  27. transition: 0.5;
  28. letter-spacing: 4px;
  29. -webkit-box-reflect: below 1px linear-gradient(transparent, #0005);
  30. }
  31. a:nth-child(1) {
  32. filter: hue-rotate(290deg);
  33. }
  34. a:nth-child(3) {
  35. filter: hue-rotate(110deg);
  36. }
  37. a:hover {
  38. background: #03e9f4;
  39. color: #050801;
  40. box-shadow: 0 0 5px #03e9f4,
  41. 0 0 25px #03e9f4,
  42. 0 0 50px #03e9f4,
  43. 0 0 200px #03e9f4;
  44. }
  45. a span {
  46. position: absolute;
  47. display: block;
  48. }
  49. a span:nth-child(1) {
  50. top: 0;
  51. left: -100%;
  52. width: 100%;
  53. height: 2px;
  54. background: linear-gradient(90deg, transparent, #03e9f4);
  55. animation: animate1 1s linear infinite;
  56. }
  57. @keyframes animate1 {
  58. 0% {
  59. left: -100%;
  60. }
  61. 50%,
  62. 100% {
  63. left: 100%;
  64. }
  65. }
  66. a span:nth-child(2) {
  67. top: 0;
  68. right: 0;
  69. height: 100%;
  70. width: 2px;
  71. background: linear-gradient(92deg, transparent, #03e9f4);
  72. animation: animate2 1s linear infinite;
  73. animation-delay: 0.25s;
  74. }
  75. @keyframes animate2 {
  76. 0% {
  77. top: -100%;
  78. }
  79. 50%,
  80. 100% {
  81. top: 100%;
  82. }
  83. }
  84. a span:nth-child(3) {
  85. bottom: 0;
  86. right: -100%;
  87. height: 2px;
  88. width: 100%;
  89. background: linear-gradient(180deg, transparent, #03e9f4);
  90. animation: animate3 1s linear infinite;
  91. animation-delay: 0.5s;
  92. }
  93. @keyframes animate3 {
  94. 0% {
  95. right: -100%;
  96. }
  97. 50%,
  98. 100% {
  99. right: 100%;
  100. }
  101. }
  102. a span:nth-child(4) {
  103. bottom: -100%;
  104. left: 0;
  105. width: 2px;
  106. height: 100%;
  107. background: linear-gradient(270deg, transparent, #03e9f4);
  108. animation: animate4 1s linear infinite;
  109. animation-delay: 0.75s;
  110. }
  111. @keyframes animate4 {
  112. 0% {
  113. bottom: -100%;
  114. }
  115. 50%,
  116. 100% {
  117. bottom: 100%;
  118. }
  119. }
  120. </style>
  121. </head>
  122. <body>
  123. <a href="#">
  124. <span></span>
  125. <span></span>
  126. <span></span>
  127. <span></span>
  128. NENO BUTTON
  129. </a>
  130. <a href="#">
  131. <span></span>
  132. <span></span>
  133. <span></span>
  134. <span></span>
  135. NENO BUTTON
  136. </a>
  137. <a href="#">
  138. <span></span>
  139. <span></span>
  140. <span></span>
  141. <span></span>
  142. NENO BUTTON
  143. </a>
  144. </body>
  145. </html>

到此这篇关于CSS3.0实现霓虹灯按钮动画特效的示例代码的文章就介绍到这了,更多相关CSS霓虹灯按钮内容请搜索w3xue以前的文章或继续浏览下面的相关文章,希望大家以后多多支持w3xue!

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号