JSFiddle - React, Tailwind, and code Playground
HTML
<!-- Erste Kopfzeile -->
<header class="top-header">
Erste Kopfzeile
</header>
<!-- Zweite Kopfzeile -->
<header class="nav-header">
<div class="logo">
Navigation
</div>
<!-- Desktop Navigation -->
<nav class="nav-links">
<a href="#">Link1</a>
<a href="#">Link2</a>
<a href="#">Link3</a>
</nav>
<!-- Hamburger -->
<div class="hamburger" id="hamburger">
<span></span>
<span></span>
<span></span>
</div>
</header>
<!-- Mobile Menü -->
<nav class="mobile-menu" id="mobileMenu">
<a href="#">Link1</a>
<a href="#">Link2</a>
<a href="#">Link3</a>
</nav>
<!-- Inhalt -->
<main class="content">
<div class="grid">
<div class="box">Box 1</div>
<div class="box">Box 2</div>
<div class="box">Box 3</div>
<div class="box">Box 4</div>
<div class="box">Box 5</div>
<div class="box">Box 6</div>
<div class="box">Box 7</div>
<div class="box">Box 8</div>
<div class="box">Box 9</div>
<div class="box">Box 10</div>
</div>
</main>
<!-- Footer -->
<footer>
Fußzeile (immer sichtbar)
</footer>
<script>
const hamburger = document.getElementById('hamburger');
const mobileMenu = document.getElementById('mobileMenu');
hamburger.addEventListener('click', () => {
mobileMenu.classList.toggle('active');
});
</script>
CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
background: #f1f5f9;
overflow: auto;
}
/* =========================
ERSTE KOPFZEILE
========================== */
.top-header {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 50px;
background: #0f172a;
color: white;
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
/* =========================
ZWEITE KOPFZEILE
========================== */
.nav-header {
position: fixed;
top: 50px;
left: 0;
width: 100%;
height: 60px;
background: #2563eb;
color: white;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
z-index: 1000;
}
/* Desktop Links */
.nav-links {
display: flex;
gap: 25px;
}
.nav-links a {
color: white;
text-decoration: none;
font-weight: bold;
}
.nav-links a:hover {
text-decoration: underline;
}
/* Hamburger */
.hamburger {
display: none;
flex-direction: column;
cursor: pointer;
gap: 5px;
}
.hamburger span {
width: 28px;
height: 3px;
background: white;
border-radius: 2px;
}
/* Mobile Menü */
.mobile-menu {
position: fixed;
top: 110px;
left: 0;
width: 100%;
background: #1d4ed8;
display: none;
flex-direction: column;
z-index: 999;
}
.mobile-menu a {
color: white;
text-decoration: none;
padding: 15px 20px;
border-top: 1px solid rgba(255,255,255,0.2);
}
.mobile-menu a:hover {
background: rgba(255,255,255,0.1);
}
.mobile-menu.active {
display: flex;
}
/* =========================
FOOTER
========================== */
footer {
position: fixed;
...