Skip to main content
Proyecto Neptuno features a consistent navigation pattern across all pages, with a responsive hamburger menu for mobile devices. The entire system is built with pure HTML and CSS — no JavaScript required.

Header Structure

The header is identical across all 5 pages, ensuring consistent navigation:
<header>
    <div>
        <a href="./index.html"><img src="./img/logo.png" alt="Logo CC Neptuno"></a>
    </div>

    <input type="checkbox" id="btn-menu">
    <label for="btn-menu" class="hamburger">
        <span class="line"></span>
        <span class="line"></span>
        <span class="line"></span>
    </label>

    <nav>
        <ul>
            <li><a href="./index.html">Inicio</a></li>
            <li><a href="./ocio.html">Ocio</a></li>
            <li><a href="./gastro.html">Gastronomía</a></li>
            <li><a href="./proyecto.html">El Proyecto</a></li>
            <li><a href="./contact.html">Contacto</a></li>
        </ul>
    </nav>
</header>

Header Components

Logo

Clickable logo linking back to homepage

Navigation Menu

5 main navigation links to all pages

Hamburger Toggle

Mobile menu trigger (hidden on desktop)

CSS Implementation

Desktop Navigation

On desktop screens, the header uses flexbox for horizontal layout:
header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    width: 100%;
    padding: 1rem 5%;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-principal);
    height: 10vh;
    border-bottom: 1px solid #e0e0e0;
}

header nav {
    width: 70%;
}

header ul { 
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header li {
    list-style: none;
}

header a {
    text-decoration: none;
    color: black;
}
Key Features:
  • position: sticky keeps header visible on scroll
  • z-index: 1000 ensures it stays above content
  • Flexbox distributes links evenly
  • Bottom border provides subtle separation

Hamburger Menu (Mobile)

The hamburger menu uses a checkbox hack for CSS-only interaction:
<!-- Hidden checkbox controls menu state -->
<input type="checkbox" id="btn-menu">

<!-- Label acts as the clickable hamburger icon -->
<label for="btn-menu" class="hamburger">
    <span class="line"></span>
    <span class="line"></span>
    <span class="line"></span>
</label>

<!-- Navigation menu (slides in when checkbox is checked) -->
<nav>
    <ul>
        <li><a href="./index.html">Inicio</a></li>
        <!-- More links -->
    </ul>
</nav>

How the Checkbox Hack Works

This technique relies on the CSS :checked pseudo-class and sibling selectors (~).

The Mechanism

  1. Checkbox: Hidden <input type="checkbox"> maintains state
  2. Label: Visible <label> triggers checkbox when clicked
  3. Navigation: Sibling <nav> element responds to checkbox state
  4. CSS Selector: #btn-menu:checked ~ nav selects nav when checkbox is checked
/* Default: Menu hidden */
header nav {
    left: -100%;
}

/* When checkbox is checked: Menu visible */
#btn-menu:checked ~ nav {
    left: 0;
}
<header>
    <!-- 1. Hidden checkbox -->
    <input type="checkbox" id="btn-menu">
    
    <!-- 2. Clickable label -->
    <label for="btn-menu" class="hamburger">
        <span class="line"></span>
        <span class="line"></span>
        <span class="line"></span>
    </label>
    
    <!-- 3. Navigation (sibling of checkbox) -->
    <nav>
        <!-- Menu items -->
    </nav>
</header>

Responsive Breakpoints

The navigation adapts at different screen widths:
/* Default desktop styles */
header {
    display: flex;
    justify-content: space-between;
}

header nav {
    width: 70%;
    position: static;
}

header ul {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.hamburger {
    display: none;
}
Features:
  • Full horizontal menu visible
  • Hamburger icon hidden
  • Links evenly distributed
A secondary navigation exists in the footer:
<footer>
    <div class="footer-inner">
        <p class="footer-copy">2026 Proyecto Neptuno — Propuesta de renovación ficticia para Granada</p>
        <nav class="footer-nav" aria-label="Navegación secundaria">
            <a href="./index.html">Inicio</a>
            <a href="./ocio.html">Ocio</a>
            <a href="./gastro.html">Gastronomía</a>
            <a href="./proyecto.html">El proyecto</a>
            <a href="./contact.html">Contacto</a>
        </nav>
    </div>
</footer>
footer {
    background-color: var(--bg-footer);
    padding: 2.5rem 5%;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-nav {
    display: flex;
    gap: 2rem;
}

.footer-nav a {
    font-size: 0.8rem;
    color: var(--texto-muted);
    text-decoration: none;
    transition: var(--transicion-suave);
}

.footer-nav a:hover {
    color: var(--color-secundario);
}
Features:
  • Dark background with light text
  • Horizontal link layout
  • Hover color transition
  • Accessible with aria-label

Design Patterns

The header uses position: sticky to remain visible during scroll:
header {
    position: sticky;
    top: 0;
    z-index: 1000;
}
Benefits:
  • Always accessible navigation
  • No JavaScript scroll listeners needed
  • Better UX for long pages

Transition Effects

Smooth animations enhance the menu experience:
header nav {
    transition: all 0.4s ease;
}

.hamburger .line {
    transition: all 0.3s;
}

.footer-nav a {
    transition: var(--transicion-suave); /* 0.3s ease */
}

Accessibility Considerations

ARIA Labels

Footer nav uses aria-label="Navegación secundaria" to distinguish from main nav

Alt Text

Logo image includes descriptive alt text: "Logo CC Neptuno"

Semantic HTML

Uses <nav> and <header> elements for proper document structure

Focus States

Links maintain default focus indicators for keyboard navigation

Key Takeaways

No JavaScript Required: The entire navigation system, including the mobile hamburger menu, works with pure HTML and CSS using the checkbox hack technique.
  • Header is consistent across all pages
  • Hamburger menu uses checkbox + label + sibling selector
  • Sticky positioning keeps nav accessible
  • Footer provides secondary navigation
  • Fully responsive with smooth transitions
  • Accessible with semantic HTML and ARIA labels

Next Steps

Project Overview

Return to project structure overview

Pages Documentation

Learn about individual page structures

Build docs developers (and LLMs) love