UI Component

创建支持暗黑模式的 Tailwind CSS 卡片

支持工具:ChatGPTCursor

使用场景

使用 Tailwind CSS 构建一个响应式卡片,该卡片需要同时支持亮色和暗色模式。

Prompt 正文

将以下内容复制到你选择的 AI 工具中。

创建一个使用 Tailwind CSS 的卡片组件。卡片应包含图片、标题、描述和标签。它必须是响应式的,并且支持通过 `dark:` 修饰符切换到暗黑模式。
在 Cursor 中打开

示例输出

<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md overflow-hidden hover:shadow-xl transition-shadow duration-300">
  <img class="w-full h-48 object-cover" src="image-url.jpg" alt="Card Image">
  <div class="p-6">
    <h2 class="text-2xl font-bold text-gray-900 dark:text-white mb-2">Card Title</h2>
    <p class="text-gray-700 dark:text-gray-300 mb-4">This is a description of the card content.</p>
    <span class="inline-block bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded-full">Tailwind</span>
  </div>
</div>