ウェブサイトの上部(通常はロゴとナビゲーションを含む)
レスポンシブヘッダーコンポーネントで、小さくて魅力的なアニメーションとTailwind CSSを使用したダークテーマのサポートによるマイクロインタラクションが特徴です。
<header class="bg-white dark:bg-gray-800 shadow-md p-4 transition duration-500"> <div class="flex justify-between items-center"> <div class="flex items-center"> <img src="https://picsum.photos/40" alt="Logo" class="h-10 w-10 rounded-full mr-2 transition-transform duration-300 transform hover:scale-110" /> <h1 class="text-xl font-bold text-gray-800 dark:text-white transition-colors duration-500">My Website</h1> </div> <nav> <ul class="flex space-x-4"> <li class="group"> <a href="#" class="text-gray-700 dark:text-gray-300 hover:text-blue-500 dark:hover:text-blue-400 transition-all duration-300">Home</a> </li> <li class="group"> <a href="#" class="text-gray-700 dark:text-gray-300 hover:text-blue-500 dark:hover:text-blue-400 transition-all duration-300">About</a> </li> <li class="group"> <a href="#" class="text-gray-700 dark:text-gray-300 hover:text-blue-500 dark:hover:text-blue-400 transition-all duration-300">Services</a> </li> <li class="group"> <a href="#" class="text-gray-700 dark:text-gray-300 hover:text-blue-500 dark:hover:text-blue-400 transition-all duration-300">Contact</a> </li> </ul> </nav> <div class="relative"> <img src="https://randomuser.me/api/portraits/men/1.jpg" alt="User Avatar" class="h-10 w-10 rounded-full border-2 border-gray-300 dark:border-gray-600 transition-transform duration-300 transform hover:scale-110" /> </div> </div> </header>
Tailwind CSSでデザインされた生で大胆なヘッダーコンポーネントで、明るいテーマと暗いテーマの両方に適した高コントラストと珍しいレイアウトが特徴です。
<header class="bg-gray-900 text-white p-6"> <div class="flex justify-between items-center"> <div class="flex items-center space-x-4"> <img src="https://picsum.photos/50" alt="Logo" class="w-16 h-16 rounded-full border-4 border-yellow-500"> <h1 class="text-3xl font-bold">Brutalist Header</h1> </div> <nav class="flex space-x-6"> <a href="#" class="text-yellow-300 hover:underline">Home</a> <a href="#" class="text-yellow-300 hover:underline">About</a> <a href="#" class="text-yellow-300 hover:underline">Services</a> <a href="#" class="text-yellow-300 hover:underline">Contact</a> </nav> </div> <div class="mt-4 pt-4 border-t border-yellow-500 flex flex-col space-y-2"> <h2 class="text-xl font-bold">Welcome to the Brutalist World</h2> <p class="text-sm">This is a header component that embodies the raw and bold aesthetics of Brutalism.</p> </div> </header> <style> @media (prefers-color-scheme: dark) { header { background-color: #1c1917; color: #f9fafb; } a { color: #fbbf24; } } </style>