码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • class的流光效果


    效果图:

    代码示例

    1. <!DOCTYPE html>
    2. <html lang="zh">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
    6. <title>Document</title>
    7. <style>
    8. * {
    9. margin: 0;
    10. padding: 0;
    11. }
    12. /* 流光效果 */
    13. .light {
    14. position: absolute;
    15. display: block;
    16. }
    17. .light:nth-child(1) {
    18. filter: hue-rotate(0deg);
    19. top: 0;
    20. left: 0;
    21. width: 100%;
    22. height: 3px;
    23. background: linear-gradient(90deg, transparent, #3a86ff);
    24. animation: animate1 8s linear infinite;
    25. }
    26. @keyframes animate1 {
    27. 0% {
    28. left: -100%;
    29. }
    30. 50%,
    31. 100% {
    32. left: 100%;
    33. }
    34. }
    35. .light:nth-child(2) {
    36. filter: hue-rotate(60deg);
    37. top: -100%;
    38. right: 0;
    39. width: 3px;
    40. height: 100%;
    41. background: linear-gradient(180deg, transparent, #3a86ff);
    42. animation: animate2 8s linear infinite;
    43. animation-delay: 2s;
    44. }
    45. @keyframes animate2 {
    46. 0% {
    47. top: -100%;
    48. }
    49. 50%,
    50. 100% {
    51. top: 100%;
    52. }
    53. }
    54. .light:nth-child(3) {
    55. filter: hue-rotate(120deg);
    56. bottom: 0;
    57. right: 0;
    58. width: 100%;
    59. background: linear-gradient(270deg, transparent, #3a86ff);
    60. animation: animate3 8s linear infinite;
    61. animation-delay: 4s;
    62. }
    63. @keyframes animate3 {
    64. 0% {
    65. right: -100%;
    66. height: 3px;
    67. }
    68. 50%,
    69. 100% {
    70. height: 2px;
    71. right: 100%;
    72. }
    73. }
    74. .light:nth-child(4) {
    75. filter: hue-rotate(300deg);
    76. bottom: -100%;
    77. left: 0;
    78. width: 3px;
    79. height: 100%;
    80. background: linear-gradient(360deg, transparent, #3a86ff);
    81. animation: animate4 8s linear infinite;
    82. animation-delay: 6s;
    83. }
    84. @keyframes animate4 {
    85. 0% {
    86. bottom: -100%;
    87. }
    88. 50%,
    89. 100% {
    90. bottom: 100%;
    91. }
    92. }
    93. .boxs {
    94. width: 100%;
    95. display: flex;
    96. justify-content: center;
    97. overflow: hidden;
    98. }
    99. .box {
    100. width: 300px;
    101. height: 300px;
    102. background-color: antiquewhite;
    103. text-align: center;
    104. }
    105. .box {
    106. position: relative;
    107. /* 让伪元素相对于.box定位 */
    108. overflow: hidden;
    109. /* 隐藏超出.box的部分 */
    110. }
    111. </style>
    112. </head>
    113. <body>
    114. <div class="boxs">
    115. <div class="box">
    116. <span class="light"></span><span class="light"></span><span class="light"></span><span class="light"></span>
    117. <p>流光效果</p>
    118. </div>
    119. </div>
    120. </body>
    121. </html>

    希望可以帮到大家

  • 相关阅读:
    企业计算机服务器中了faust勒索病毒怎么解密,faust勒索病毒解密流程
    基于JAVA医院医护人员排班系统计算机毕业设计源码+系统+mysql数据库+lw文档+部署
    环形缓冲区-----适合在通信中接收数据(例如uart)
    【ARM Trace32(劳特巴赫) 使用介绍 3 - trace32 访问运行时的内存】
    云计算的思想、突破、产业实践
    【快速搞定Webpack5】基本配置及开发模式介绍(二)
    读像火箭科学家一样思考笔记03_第一性原理(上)
    56.【树型结构】
    antdv使用a-cascader联级选择器实现自定义浮层样式
    noetic 怎么下载robotiq_modbus_tcp 从而使用robotiq二指夹爪
  • 原文地址:https://blog.csdn.net/tianxianghuiwei/article/details/139844862
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号