/
prog_dev
/
DEV
Обзор
Документация
Войти
/
prog_dev
/
DEV
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
index.php
182 строки
5 KB
Prog Dev
update index.php
03 дек 2025, 15:54
03 дек 2025, 15:54
0f58e28
Код
Авторство
О чём код?
<!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>Header с меню по центру</title> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet"> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f8f9fa; } header { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 15px 40px; background: white; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); position: relative; z-index: 1000; } .left { display: flex; gap: 20px; } .btn { background: none; border: none; font-size: 18px; cursor: pointer; color: #333; transition: color 0.3s; } .btn:hover { color: #0066cc; } .center-menu { display: flex; list-style: none; gap: 30px; position: absolute; left: 50%; transform: translateX(-50%); } .center-menu a { text-decoration: none; color: #333; font-weight: 500; font-size: 16px; transition: color 0.3s; } .center-menu a:hover { color: #0066cc; } .right { display: flex; align-items: center; gap: 20px; } .logo { font-size: 20px; font-weight: 700; color: #0066cc; } .burger { display: none; font-size: 24px; background: none; border: none; cursor: pointer; color: #333; } .mobile-menu { display: none; position: absolute; top: 100%; left: 0; width: 100%; background: white; box-shadow: 0 4px 10px rgba(0,0,0,0.1); flex-direction: column; padding: 10px 0; } .mobile-menu a { padding: 12px 40px; text-decoration: none; color: #333; font-size: 16px; } .mobile-menu a:hover { background: #f1f1f1; } @media (max-width: 992px) { .center-menu { display: none; } .burger { display: block; } .mobile-menu.active { display: flex; } } @media (max-width: 576px) { header { padding: 15px 20px; } .left .btn, .right .logo { font-size: 16px; } } </style> </head> <body> <header> <!-- Левая часть: Поиск и Войти --> <div class="left"> <button class="btn" title="Поиск"><i class="fas fa-search"></i></button> <button class="btn" title="Войти"><i class="fas fa-user"></i> Войти</button> </div> <!-- Центральное меню --> <nav class="center-menu"> <a href="#">Главная</a> <a href="#">Каталог</a> <a href="#">О нас</a> <a href="#">Контакты</a> </nav> <!-- Правая часть: Логотип и бургер --> <div class="right"> <div class="logo">LOGO</div> <button class="burger" id="burger"><i class="fas fa-bars"></i></button> </div> <!-- Мобильное меню --> <nav class="mobile-menu" id="mobileMenu"> <a href="#">Главная</a> <a href="#">Каталог</a> <a href="#">О нас</a> <a href="#">Контакты</a> </nav> </header> <script> const burger = document.getElementById('burger'); const mobileMenu = document.getElementById('mobileMenu'); burger.addEventListener('click', () => { mobileMenu.classList.toggle('active'); }); </script> </body> </html>