css button 点击结果

[复制链接]
发表于 2025-9-23 02:24:25 | 显示全部楼层 |阅读模式

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

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

×
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4.   <meta charset="UTF-8">
  5.   <title>button点击效果</title>
  6.   <style>
  7.     #container {
  8.       display: flex;
  9.       align-items: center;
  10.       justify-content: center;
  11.     }
  12.     .pushable {
  13.       position: relative;
  14.       background: transparent;
  15.       padding: 0px;
  16.       border: none;
  17.       cursor: pointer;
  18.       outline-offset: 4px;
  19.       outline-color: deeppink;
  20.       transition: filter 250ms;
  21.       -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  22.     }
  23.     .shadow {
  24.       position: absolute;
  25.       top: 0;
  26.       left: 0;
  27.       height: 100%;
  28.       width: 100%;
  29.       background: hsl(226, 25%, 69%);
  30.       border-radius: 8px;
  31.       filter: blur(2px);
  32.       will-change: transform;
  33.       transform: translateY(2px);
  34.       transition: transform 600ms cubic-bezier(0.3, 0.7, 0.4, 1);
  35.     }
  36.     .edge {
  37.       position: absolute;
  38.       top: 0;
  39.       left: 0;
  40.       height: 100%;
  41.       width: 100%;
  42.       border-radius: 8px;
  43.       background: linear-gradient(to right,
  44.           hsl(248, 39%, 39%) 0%,
  45.           hsl(248, 39%, 49%) 8%,
  46.           hsl(248, 39%, 39%) 92%,
  47.           hsl(248, 39%, 29%) 100%);
  48.     }
  49.     .front {
  50.       display: block;
  51.       position: relative;
  52.       border-radius: 8px;
  53.       background: hsl(248, 53%, 58%);
  54.       padding: 16px 32px;
  55.       color: white;
  56.       font-weight: 600;
  57.       text-transform: uppercase;
  58.       letter-spacing: 1.5px;
  59.       font-size: 1rem;
  60.       transform: translateY(-4px);
  61.       transition: transform 600ms cubic-bezier(0.3, 0.7, 0.4, 1);
  62.     }
  63.     .pushable:hover {
  64.       filter: brightness(110%);
  65.     }
  66.     .pushable:hover .front {
  67.       transform: translateY(-6px);
  68.       transition: transform 250ms cubic-bezier(0.3, 0.7, 0.4, 1.5);
  69.     }
  70.     .pushable:active .front {
  71.       transform: translateY(-2px);
  72.       transition: transform 34ms;
  73.     }
  74.     .pushable:hover .shadow {
  75.       transform: translateY(4px);
  76.       transition: transform 250ms cubic-bezier(0.3, 0.7, 0.4, 1.5);
  77.     }
  78.     .pushable:active .shadow {
  79.       transform: translateY(1px);
  80.       transition: transform 34ms;
  81.     }
  82.     .pushable:focus:not(:focus-visible) {
  83.       outline: none;
  84.     }
  85.   </style>
  86. </head>
  87. <body>
  88.   <div id="container">
  89.     <button class="pushable">
  90.       <span class="shadow"></span>
  91.       <span class="edge"></span>
  92.       <span class="front">梦雨生生</span>
  93.     </button>
  94.   </div>
  95.   <script>
  96.   </script>
  97. </body>
  98. </html>
复制代码
回复

使用道具 举报

登录后关闭弹窗

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