one page !

Les liens internes en HTML se font avec <a href="#id">, où id correspond à l’identifiant de la section ciblée.

La propriété scroll-behavior: smooth; en CSS permet d’avoir une navigation fluide entre les sections.

Une barre de navigation fixe se fait avec position: fixed; en CSS.

à vous de jouer !!

Code HTML de la page

<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Navigation Verticale</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>

    <!-- Barre de navigation -->
    <nav>
        <a href="#section1">Section 1</a>
        <a href="#section2">Section 2</a>
        <a href="#section3">Section 3</a>
    </nav>

    <!-- Sections -->
    <div id="section1" class="section">
        <h2>Section 1</h2>
        <p>Cliquez ci-dessous pour descendre :</p>
        <a href="#section2" class="btn">Aller à la section 2</a>
    </div>

    <div id="section2" class="section">
        <h2>Section 2</h2>
        <p>Cliquez ci-dessous pour descendre :</p>
        <a href="#section3" class="btn">Aller à la section 3</a>
        <br>
        <p>Ou remonter :</p>
        <a href="#section1" class="btn">Retour à la section 1</a>
    </div>

    <div id="section3" class="section">
        <h2>Section 3</h2>
        <p>Cliquez ci-dessous pour remonter :</p>
        <a href="#section1" class="btn">Retour en haut</a>
    </div>

</body>
</html>

code CSS de la page

/* Styles de base */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    scroll-behavior: smooth; /* Animation de défilement fluide */
}

/* Barre de navigation */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 0;
    text-align: center;
}

nav a {
    color: white;
    text-decoration: none;
    margin: 0 15px;
    font-size: 18px;
}

nav a:hover {
    text-decoration: underline;
}

/* Sections */
.section {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
}

/* Différenciation visuelle des sections */
#section1 { background: #f8b400; }
#section2 { background: #6a0572; color: white; }
#section3 { background: #056676; color: white; }

/* Boutons internes */
.btn {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background: white;
    color: black;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: 0.3s;
}

.btn:hover {
    background: #ddd;
}