组件 Back to Top 按钮 Back to Top Button 组件

Back to Top Button 组件

适用于电子商务网站的响应式“Back to Top”按钮组件,采用黑白单色设计,具有明亮的强调色,并在悬停时提供引人入胜的微交互。包括深色模式支持。

预览

HTML 代码

<div class="fixed bottom-4 right-4 z-50">
  <!-- Back to Top Button -->
  <a href="#top" aria-label="Scroll back to top of page" class="group outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-gray-900 rounded-full">
    <button class="relative w-12 h-12 md:w-14 md:h-14 lg:w-16 lg:h-16 flex items-center justify-center bg-white dark:bg-gray-800 rounded-full shadow-lg transition-all duration-300 ease-in-out transform group-hover:-translate-y-1 group-focus:-translate-y-1 group-active:-translate-y-1 group-hover:scale-105 group-focus:scale-105 group-active:scale-105 overflow-hidden border border-gray-200 dark:border-gray-700">
      <!-- Background accent on hover -->
      <div class="absolute inset-0 bg-purple-500 rounded-full scale-0 group-hover:scale-100 group-focus:scale-100 group-active:scale-100 transition-transform duration-300 ease-out"></div>
      
      <!-- SVG Icon -->
      <svg class="relative w-6 h-6 md:w-7 md:h-7 lg:w-8 lg:h-8 text-gray-800 dark:text-white group-hover:text-white dark:group-hover:text-white transition-colors duration-300 ease-in-out" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 10l7-7m0 0l7 7m-7-7v18"></path>
      </svg>
    </button>
  </a>
</div>

相关组件

Back to Top Button 组件

一个响应式、视觉上吸引人的“返回顶部”按钮,具有三重配色方案、渐变和平滑过渡,适用于作品集网站,包括深色模式支持。

打开

回到顶部按钮

一个响应式返回顶部按钮组件,采用玻璃拟态效果,适用于专业的企业网站。它具有简单的布局和最少的元素,适用于浅色和深色主题。

打开

粗野主义返回顶部按钮

一个在Tailwind CSS中具有高对比度、大胆排版和锐利边缘的粗犷风格返回顶部按钮。包括响应式大小和暗模式支持。

打开