web前端动画按钮(附源代码)

[复制链接]
发表于 2025-12-27 13:36:09 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
结果图



源代码

HTML部分
  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>Document</title>
  7. </head>
  8. <link rel="stylesheet" href="..\暑假学习网页小零件\按钮2.css">
  9. <body>
  10. <a href="">爱莉希雅</a>
  11. <a href="">爱莉希雅</a>
  12. <a href="">爱莉希雅</a>
  13.    
  14. </body>
  15. </html>
复制代码
css部分
  1. *{
  2.     margin: 0;
  3.     padding: 0;
  4.     box-sizing: border-box;
  5. }
  6. body{
  7.     display: flex;
  8.     justify-content: center;
  9.     align-items: center;
  10.     gap: 100px;
  11.     background-color: black;
  12.     min-height: 100vh;
  13. }
  14. a{
  15.     position: relative;
  16.     padding: 10px 50px;
  17.     margin: 45px 0;
  18.     color:pink;
  19.     text-decoration: none;
  20.     font-size: 25px;
  21.     font-family: 'Times New Roman', Times, serif;
  22.     overflow: hidden;
  23.     transition: all 0.4s;
  24.     -webkit-box-reflect: below 1px linear-gradient(transparent,#0003);
  25.    
  26. }
  27. a::before{
  28.     position: absolute;
  29.     content: "";
  30.     top: 0;
  31.     left: 0;
  32.     border-left: 3px solid pink;
  33.     border-top: 3px solid pink;
  34.     width: 20px;
  35.     height: 15px;
  36.     transition: all 0.5s;
  37. }
  38. a::after{
  39.     position: absolute;
  40.     content: "";
  41.     bottom: 0;
  42.     right: 0;
  43.     border-right: 3px solid pink;
  44.     border-bottom: 3px solid pink;
  45.     width: 20px;
  46.     height: 15px;
  47.     transition: all 0.5s;
  48. }
  49. a:hover::before,
  50. a:hover::after{
  51.     width: 100%;
  52.     height: 100%;
  53. }
  54. a:hover{
  55.     background-color: pink;
  56.     color: black;
  57.     box-shadow: 0 0 pink;
  58.     transition-delay: 0.5s;
  59. }
  60. /* 选择父元素下特定的位置,可以是数字,odd(奇数),even(偶数)或者表达式。 */
  61. a:nth-child(1){   
  62.     /* 滤镜 */
  63.     filter: hue-rotate(150deg);
  64. }
  65. a:nth-child(3)
  66. {
  67.     filter: hue-rotate(280deg);
  68. }
复制代码
回复

使用道具 举报

登录后关闭弹窗

登录参与点评抽奖  加入IT实名职场社区
去登录
快速回复 返回顶部 返回列表