组件 导航 导航组件

导航组件

为深色模式UI设计的响应式导航组件,具有链接、下拉菜单和徽标,均采用Tailwind CSS样式。

预览

HTML 代码

<nav class="bg-gray-800 p-4 fixed w-full">
    <div class="flex justify-between items-center">
        <div class="text-white text-lg font-bold">
            <a href="#" class="flex items-center">
                <img src="https://picsum.photos/40" alt="Logo" class="mr-2 rounded-full">
                MyApp
            </a>
        </div>
        <div class="hidden md:flex space-x-4">
            <a href="#" class="text-gray-300 hover:bg-gray-700 px-3 py-2 rounded">Home</a>
            <a href="#" class="text-gray-300 hover:bg-gray-700 px-3 py-2 rounded">About</a>
            <div class="relative">
                <button class="text-gray-300 hover:bg-gray-700 px-3 py-2 rounded flex items-center">Services
                    <svg class="w-4 h-4 ml-1" 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 15l7-7 7 7"/>
                    </svg>
                </button>
                <div class="absolute left-0 hidden bg-gray-800 text-white mt-1 rounded shadow-md w-40">
                    <a href="#" class="block px-4 py-2 hover:bg-gray-700">Web Design</a>
                    <a href="#" class="block px-4 py-2 hover:bg-gray-700">SEO</a>
                    <a href="#" class="block px-4 py-2 hover:bg-gray-700">Marketing</a>
                </div>
            </div>
            <a href="#" class="text-gray-300 hover:bg-gray-700 px-3 py-2 rounded">Contact</a>
        </div>
        <div class="md:hidden">
            <button class="text-gray-300 hover:bg-gray-700 px-3 py-2 rounded focus:outline-none">
                <svg class="w-6 h-6" 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="M4 6h16M4 12h16m-7 6h7"/>
                </svg>
            </button>
        </div>
    </div>
</nav>

<div class="mt-16 p-4">
    <h1 class="text-3xl text-white">Welcome to MyApp</h1>
    <p class="text-gray-300">This is an example of a dark mode navigation component using Tailwind CSS.</p>
</div>

<style>
    .dropdown:hover .dropdown-content {
        display: block;
    }
</style>

相关组件

复古导航

一个简单、响应式且兼容暗黑模式的导航组件,采用复古/古典设计,色彩鲜艳,元素简约,适合电子商务网站。

打开

拟物导航组件

一个拟物导航组件,旨在模仿现实世界的元素,如物理控制面板或仪表板。具有响应式设计,悬停效果模拟物理按钮按压,支持暗黑主题。导航包括微妙的阴影、渐变和纹理,营造出3D的触感外观,令人想起物理接口。

打开

响应式导航组件

具有微交互、灰度配色方案和简单复杂性的响应式导航组件。

打开