组件 徽章 徽章组件

徽章组件

一个 Neumorphic Badges 组件,具有博客/内容网站的类似配色方案。它具有响应式设计和深色主题支持,仅使用 HTML 和 Tailwind CSS。

预览

HTML 代码

<div class="flex flex-wrap justify-center items-center h-screen bg-gray-200 dark:bg-gray-800 p-6">

  <!-- Badge 1 -->
  <div class="m-4">
    <span class="inline-flex items-center px-4 py-2 rounded-full text-sm font-medium
                   bg-gradient-to-br from-indigo-200 to-purple-300 dark:from-indigo-700 dark:to-purple-800
                   shadow-neumorphic-light dark:shadow-neumorphic-dark
                   text-gray-700 dark:text-gray-200
                   transition duration-300 ease-in-out transform hover:scale-105">
      <svg class="w-4 h-4 mr-2" 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 13l4 4L19 7"></path></svg>
      Category A
    </span>
  </div>

  <!-- Badge 2 -->
  <div class="m-4">
    <span class="inline-flex items-center px-4 py-2 rounded-full text-sm font-medium
                   bg-gradient-to-br from-blue-200 to-indigo-300 dark:from-blue-700 dark:to-indigo-800
                   shadow-neumorphic-light dark:shadow-neumorphic-dark
                   text-gray-700 dark:text-gray-200
                   transition duration-300 ease-in-out transform hover:scale-105">
      <svg class="w-4 h-4 mr-2" 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="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
      New Topic
    </span>
  </div>

  <!-- Badge 3 -->
  <div class="m-4">
    <span class="inline-flex items-center px-4 py-2 rounded-full text-sm font-medium
                   bg-gradient-to-br from-purple-200 to-pink-300 dark:from-purple-700 dark:to-pink-800
                   shadow-neumorphic-light dark:shadow-neumorphic-dark
                   text-gray-700 dark:text-gray-200
                   transition duration-300 ease-in-out transform hover:scale-105">
      <svg class="w-4 h-4 mr-2" 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="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
      Popular
    </span>
  </div>

  <!-- Badge 4 -->
  <div class="m-4">
    <span class="inline-flex items-center px-4 py-2 rounded-full text-sm font-medium
                   bg-gradient-to-br from-green-200 to-teal-300 dark:from-green-700 dark:to-teal-800
                   shadow-neumorphic-light dark:shadow-neumorphic-dark
                   text-gray-700 dark:text-gray-200
                   transition duration-300 ease-in-out transform hover:scale-105">
      <svg class="w-4 h-4 mr-2" 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="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
      Featured
    </span>
  </div>

  <!-- Badge 5 (with avatar)-->
  <div class="m-4">
    <span class="inline-flex items-center px-3 py-2 rounded-full text-sm font-medium
                   bg-gradient-to-br from-red-200 to-orange-300 dark:from-red-700 dark:to-orange-800
                   shadow-neumorphic-light dark:shadow-neumorphic-dark
                   text-gray-700 dark:text-gray-200
                   transition duration-300 ease-in-out transform hover:scale-105">
      <img class="h-6 w-6 rounded-full mr-2" src="https://randomuser.me/api/portraits/men/32.jpg" alt="Avatar">
      Author Name
    </span>
  </div>

</div>

<!-- To make Neumorphic shadow work, you need to extend your tailwind.config.js -->
<style>
  .shadow-neumorphic-light {
    box-shadow: 6px 6px 12px #a8a8a8, -6px -6px 12px #ffffff;
  }
  .dark .shadow-neumorphic-dark {
    box-shadow: 6px 6px 12px #4a4a4a, -6px -6px 12px #323232;
  }
</style>

相关组件

徽章组件

一个响应式徽章组件,具有 Material Design 样式、深色主题支持和博客内容的大地色调配色方案。

打开

徽章组件

一个响应式徽章组件,采用玻璃风格设计,具有磨砂玻璃般的半透明元素和模糊效果,支持暗黑模式.

打开

Neumorphism 徽章

这是一个 Neumorphism 风格的徽章组件,具有柔和的配色方案,专为 Portfolio 设计并使用 Tailwind CSS。

打开