导航组件

一个具有响应式设计的暗模式导航栏,包含一个徽标、头像和导航链接。

预览

HTML 代码

<nav class="bg-gray-900 text-white p-4 flex justify-between items-center">
    <div class="flex items-center space-x-4">
        <img src="https://picsum.photos/50/50" alt="Logo" class="w-10 h-10 rounded-full">
        <span class="text-xl font-semibold">My Website</span>
    </div>
    <div class="hidden md:flex space-x-4">
        <a href="#" class="hover:text-gray-400 transition duration-200">Home</a>
        <a href="#" class="hover:text-gray-400 transition duration-200">About</a>
        <a href="#" class="hover:text-gray-400 transition duration-200">Services</a>
        <a href="#" class="hover:text-gray-400 transition duration-200">Contact</a>
    </div>
    <div class="relative">
        <img src="https://randomuser.me/api/portraits/men/1.jpg" alt="User Avatar" class="w-10 h-10 rounded-full cursor-pointer">
        <div class="absolute right-0 mt-2 w-48 bg-gray-800 text-white rounded-md shadow-lg hidden group-hover:block">
            <a href="#" class="block px-4 py-2 hover:bg-gray-700">Profile</a>
            <a href="#" class="block px-4 py-2 hover:bg-gray-700">Settings</a>
            <a href="#" class="block px-4 py-2 hover:bg-gray-700">Logout</a>
        </div>
    </div>
</nav>

<style>
    @media (prefers-color-scheme: dark) {
        body {
            background-color: #1a1a1a;
        }
    }
</style>

相关组件

导航组件

一个响应式导航组件,具有微交互和黑暗主题支持,采用 Tailwind CSS 设计。

打开

神经形态导航

一个简单的响应式导航组件,采用新拟态风格,专为电子商务设计.

打开

仿物体导航

一个简单的响应式导航组件,具有拟物设计,采用适合社交媒体应用的相似色彩方案,并支持暗黑主题。

打开