From 23c753d902fbce7481bb6f5f2e43a23a1cc9e952 Mon Sep 17 00:00:00 2001 From: Anthony Mahe Date: Mon, 19 May 2025 23:08:16 +0200 Subject: [PATCH] TEC : Menu Autre --- index.html | 48 +++++++++++++++++++- navigation.css | 116 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 162 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index d180882..229fc5d 100644 --- a/index.html +++ b/index.html @@ -47,13 +47,59 @@ diff --git a/navigation.css b/navigation.css index 1941fc6..cd27ac8 100644 --- a/navigation.css +++ b/navigation.css @@ -29,7 +29,6 @@ margin: 0; padding: 0; list-style: none; - overflow: hidden; } .header li { @@ -85,6 +84,121 @@ margin-left: auto; } +/* menu caché par défaut*/ +nav .menu { + list-style: none; + padding: 0; + margin: 0; + display: none; + gap: 1rem; +} + +nav .menu li { + position: relative; + white-space: nowrap; +} + +/* Sous-menu caché par défaut */ + +/* Cacher le sous-menu par défaut */ +.dropdown { + position: relative; +} + +.dropdown .submenu { + position: absolute; + top: 100%; /* place le sous-menu juste sous le bouton "Autre" */ + left: 0; /* aligne à gauche du bouton "Autre" */ + transform: translateX(-100%); /* décale le menu vers la gauche du bouton */ + background-color: white; + box-shadow: 0 2px 5px rgba(0,0,0,0.15); + z-index: 10; + display: none; + padding: 0; + list-style: none; +} + +/* Afficher le sous-menu si l’input est coché */ +.toggle-submenu:checked + label + .submenu { + display: block; +} + +/* Style du label 'Autre' */ +.dropdown label { + cursor: pointer; + padding: 0.5rem; + display: inline-block; + color: #333; + background-color: transparent; +} + +/* Style des items du sous-menu */ +.submenu li a { + display: block; + padding: 0.5rem; + text-decoration: none; + color: #333; +} + +.submenu li a:hover { + background-color: #f2f2f2; +} + +/* Grand écran : menu complet */ +@media (min-width: 1500px) { + #menuXL { + display: flex; + } +} + +/* Moyen écran */ +@media (max-width: 1499px) and (min-width: 1300px) { + #menuL { + display: flex; + } +} + +/* Petit écran */ +@media (max-width: 1299px) and (min-width: 1099px) { + #menuM { + display: flex; + } +} + +/* Mobile (burger menu géré ailleurs) */ +@media (max-width: 1100px) and (min-width: 700px){ + #menuS { + display: flex; + } +} + +/* Cacher la case à cocher */ +.toggle-submenu { + display: none; +} + + +/* Afficher le sous-menu si activé */ +.toggle-submenu:checked + label + .submenu { + display: block; +} + +/* Styles généraux */ +.dropdown { + position: relative; +} + +.dropdown label { + cursor: pointer; + display: block; + padding: 0.5rem; +} + +/* Pour que le sous-menu ne s'affiche que sous 'Autre' */ +.dropdown .submenu li { + padding: 0.5rem; +} + /* menu */ .header .menu { clear: both;