Следующий код .css, который предназначен для вытягивания меню в правую сторону экрана и логотип влево. Я играл с заполнением, фиксированными позициями, полями - логотипа, заголовка -навигатора и многого другого, и ничего, что я делаю, не работает < /p>
App.jsx
import { lazy, Suspense, useState } from 'react';
import zlogo from './personal-brand-logo.png';
import moon from './DSC00779_edited_watermarked.jpg';
import './App.css';
// Lazily load non-critical components
const About = lazy(() => import('./About.jsx'));
const Projects = lazy(() => import('./Projects.jsx'));
const Clients = lazy(() => import('./Clients.jsx'));
const Contact = lazy(() => import('./Contact.jsx'));
// Header Navigation Component
function HeaderNav() {
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
return (
setIsMobileMenuOpen((open) => !open)}
>
☰
setIsMobileMenuOpen(false)}>Home
setIsMobileMenuOpen(false)}>About
setIsMobileMenuOpen(false)}>Projects
setIsMobileMenuOpen(false)}>Clients
setIsMobileMenuOpen(false)}>Contact
);
}
< /code>
app.css
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
.App-header {
background-color: #ffffffff;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: rgb(192, 97, 251);
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* NEW HEADER STYLES */
.header {
width: 100%;
padding: 0.5rem 0;
background-color: #fff;
position: fixed; /* optional: makes header stick to top */
top: 0;
z-index: 1000;
}
.header-content {
display: flex;
justify-content: space-between;
align-items: center;
gap: 1rem;
padding: 0 24px;
max-width: 1400px; /* standard webpage max width */
margin: 0 auto; /* centers the content */
width: 100%; /* ensures it uses full width up to max */
position: relative;
}
.header-logo {
height: 56px;
width: auto;
}
.header-nav {
display: flex;
align-items: center;
gap: clamp(0.5rem, 2vw, 1.25rem);
margin-left: auto;
flex: 1 1 auto;
justify-content: flex-end;
flex-wrap: wrap;
min-width: 0;
}
/* Mobile menu toggle base (hidden by default; shown in media query) */
.mobile-menu-toggle {
display: none;
background: none;
border: none;
font-size: 1.75rem;
line-height: 1;
color: #333;
cursor: pointer;
margin-left: auto;
padding: 0.25rem;
}
.nav-link {
text-decoration: none;
color: #333;
font-weight: 500;
transition: color 0.3s ease;
font-size: clamp(0.85rem, 1.6vw, 1rem);
}
.nav-link:hover {
color: rgb(192, 97, 251); /* using your existing App-link color */
}
.external-link {
background-color: rgb(192, 97, 251); /* using your brand color */
color: white !important;
padding: 0.5rem 1rem;
border-radius: 4px;
transition: background-color 0.3s ease;
}
.external-link:hover {
background-color: rgb(172, 77, 231); /* slightly darker version */
}
/* Mobile styles first */
@media (max-width: 1463px) {
.header-nav {
padding-right: 5px; /* Add small right padding */
margin-left: auto; /* Push nav to right end */
flex-shrink: 0; /* Prevent shrinking */
max-width: calc(100% - 56px - 10px); /* Account for logo width + padding */
}
.header-logo {
margin-right: 0; /* Remove right margin if any */
}
}
@media (max-width: 1200px) {
.header-nav {
gap: 1.5rem;
}
.nav-link {
font-size: 0.9rem;
}
}
@media (max-width: 992px) {
.header-nav {
gap: 1rem;
}
.nav-link {
font-size: 0.85rem;
}
.external-link {
padding: 0.4rem 0.8rem;
font-size: 0.85rem;
}
}
@media (max-width: 768px) {
.header-content {
padding: 0 15px;
}
.header-logo {
height: 44px;
}
.mobile-menu-toggle {
display: block;
z-index: 1001;
}
.header-nav {
position: absolute;
top: 100%;
left: 0;
right: 0;
width: 100%;
margin-left: calc(-15px); /* Offset the header-content padding */
margin-right: calc(-15px); /* Offset the header-content padding */
background-color: #fff;
flex-direction: column;
padding: 1rem 15px; /* Match header-content horizontal padding */
gap: 1rem;
transform: translateY(-100%);
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
z-index: 1000;
box-sizing: border-box;
}
/* Show mobile nav when active */
.header-nav.mobile-nav-open {
transform: translateY(0);
opacity: 1;
visibility: visible;
}
.nav-link {
font-size: 1rem;
padding: 0.5rem 0;
text-align: center;
}
}
@media (max-width: 480px) {
.header-content {
padding: 0 10px;
}
.header-logo {
height: 36px;
}
}
@media (max-width: 400px) {
.header-content {
padding: 0 8px; /* Less padding for very narrow screens */
}
.header-logo {
height: 32px; /* Smaller logo */
}
.mobile-menu-toggle {
padding: 0.15rem;
font-size: 1.5rem; /* Smaller hamburger icon */
}
.header-nav {
padding: 0.75rem 8px; /* Match the header-content padding */
margin-left: calc(-8px); /* Offset the container padding */
margin-right: calc(-8px); /* Offset the container padding */
width: calc(100vw); /* Full viewport width */
}
.nav-link {
font-size: 0.9rem;
padding: 0.4rem 0;
}
}
/* If you're using fixed header, add padding to body to prevent content overlap */
body {
padding-top: 72px; /* adjust based on your header height */
padding-left: 30px;
}
.form {
background-color: rgb(0, 0, 0)
}
/* Footer styles */
.footer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 1rem 0;
}
.footer-icons {
display: inline-flex;
align-items: center;
}
.footer-icon-link + .footer-icon-link {
margin-left: 5px;
}
.footer-icon-link svg {
display: block;
}
.footer-copy {
display: block;
margin-top: 0.5rem;
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... responding
Мобильная версия