组件 媒体嵌入 媒体嵌入组件

媒体嵌入组件

一个具有复古/老式美学的响应式媒体嵌入组件,支持暗主题并包含占位符图像和头像。

预览

HTML 代码

<div class="max-w-lg mx-auto bg-white rounded-lg shadow-lg overflow-hidden dark:bg-gray-800">
    <div class="relative">
        <img class="w-full h-48 object-cover" src="https://picsum.photos/600/400?random=1" alt="Retro Media">
        <div class="absolute top-0 left-0 right-0 bg-black bg-opacity-50 p-4">
            <h2 class="text-white text-xl font-bold">Retro Media Title</h2>
            <p class="text-gray-300">This is a description of the retro media.</p>
        </div>
    </div>
    <div class="p-4">
        <h3 class="text-lg font-semibold text-gray-800 dark:text-gray-200">Posted by</h3>
        <div class="flex items-center mt-2">
            <img class="w-10 h-10 rounded-full" src="https://randomuser.me/api/portraits/men/1.jpg" alt="Avatar">
            <div class="ml-3">
                <p class="text-gray-800 dark:text-gray-200 font-semibold">John Doe</p>
                <p class="text-gray-500 dark:text-gray-400 text-sm">5 minutes ago</p>
            </div>
        </div>
    </div>
    <style>
        @media (prefers-color-scheme: dark) {
            .bg-white {background-color: #1a202c;}
            .text-gray-800 {color: #e2e8f0;}
            .text-gray-300 {color: #edf2f7;}
        }
        
        .bg-black { background-color: rgba(0, 0, 0, 0.8); }
        .rounded-lg { border-radius: 0.5rem; }
        .shadow-lg { box-shadow: 0 10px 15px rgba(0,0,0,0.2); }
        
        .text-xl { font-size: 1.25rem; }
        .text-lg { font-size: 1.125rem; }
        .text-sm { font-size: 0.875rem; }
        
        @media (max-width: 640px) {
            .h-48 { height: 12rem; }
        }
    </style>
</div>

相关组件

Retro Media 嵌入组件

具有“复古/复古”设计的响应式媒体嵌入组件,灵感来自 80 年代/90 年代的美学,如旧 CRT 显示器和 VCR 播放器。它在石板灰色底色上使用蓝绿色和橙色的互补配色方案,适用于“商业/公司”网站。该组件具有中等复杂度,在播放按钮和媒体缩略图上具有悬停效果、仿 REC 灯光动画和装饰性非功能性控制元素。它包括使用 Tailwind 的 'dark:' 前缀的深色主题支持。媒体区域设计为 16:9 纵横比(需要 Tailwind 纵横比插件或 CSS 回退,如 padding-bottom 技巧)。使用 picsum.photos 中的占位符图像。

打开

复古媒体嵌入组件

响应式媒体嵌入组件,具有复古/复古设计、鲜艳的色彩、适度的复杂性和深色模式支持,适用于电子商务平台。

打开

媒体嵌入组件

媒体嵌入组件,具有微交互、响应式效果和暗主题支持。不需要JavaScript。

打开