Menu fixé, corrigé bugs menu écran étroit

This commit is contained in:
tuxmain 2023-07-10 10:09:00 +02:00
parent 58d7b10a7f
commit 937c173679
3 changed files with 34 additions and 22 deletions

View file

@ -110,6 +110,8 @@ a:hover, a:focus {
} }
.madein { .madein {
position: relative;
z-index: -1;
width: 192px; width: 192px;
transform: rotate(-30deg); transform: rotate(-30deg);
} }

View file

@ -1,9 +1,13 @@
@import "defs"; @import "defs";
header { header {
position: sticky;
z-index: 10;
top: 0;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
max-width: 1100px; max-width: 1100px;
height: 48px;
margin: 0 auto 16px auto; margin: 0 auto 16px auto;
padding: 0 4px; padding: 0 4px;
font-size: 24px; font-size: 24px;
@ -17,12 +21,12 @@ header {
filter: drop-shadow(1px 2px 1px $violet); filter: drop-shadow(1px 2px 1px $violet);
} }
#header-menu ul { #header-menu > ul {
list-style-type: none; list-style-type: none;
margin: 9px 0 0 0; margin: 9px 0 0 0;
} }
#header-menu li { #header-menu > ul li {
display: inline-block; display: inline-block;
margin: 0 8px; margin: 0 8px;
} }
@ -38,7 +42,7 @@ header {
} }
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {
.header-menu-phone { header, .header-menu-phone {
background-color: white; background-color: white;
} }
} }
@ -48,41 +52,46 @@ header {
color: white; color: white;
} }
.header-menu-phone { header, .header-menu-phone {
background-color: black; background-color: black;
} }
} }
@media (min-width: 768px) { @media (min-width: 960px) {
.phone-only { .phone-only {
display: none; display: none;
} }
} }
@media (max-width: 767px) { @media (max-width: 959px) {
.header-menu-phone {
position: absolute;
top: 0;
left: 0;
display: flex;
flex-direction: column;
gap: 1em;
padding: 2em;
}
.phone-hidden { .phone-hidden {
display: none; display: none;
} }
} }
.header-menu-phone {
position: fixed;
z-index: 5;
top: 48px;
left: 0;
padding: 16px;
max-height: calc(100vh - 48px);
overflow-y: auto;
margin-top: 0;
box-sizing: border-box;
border-left: 2px solid $violet;
list-style: none;
}
.header-menu-phone-logo {
max-width: 100%;
width: 256px;
}
.hamburger-menu { .hamburger-menu {
font-size: 1.5em; font-size: 150%;
margin: 0.25em; margin: 0.25em;
font-family: LunaSans; font-family: LunaSans;
border: none;
background-color: transparent;
cursor: pointer;
opacity: 65%;
} }
.hamburger-menu:hover, .hamburger-menu:focus { .hamburger-menu:hover, .hamburger-menu:focus {
@ -91,4 +100,5 @@ header {
.hamburger-menu > summary { .hamburger-menu > summary {
list-style: none; list-style: none;
cursor: pointer;
} }

View file

@ -43,7 +43,7 @@
<picture> <picture>
<source srcset="/img/logo-stencil-white.svg" media="(prefers-color-scheme: dark)"/> <source srcset="/img/logo-stencil-white.svg" media="(prefers-color-scheme: dark)"/>
<source srcset="/img/logo-stencil-black.svg" media="(prefers-color-scheme: light)"/> <source srcset="/img/logo-stencil-black.svg" media="(prefers-color-scheme: light)"/>
<img decoding="async" src="/img/logo-stencil-black.svg" alt="Librezo"/> <img class="header-menu-phone-logo" decoding="async" src="/img/logo-stencil-black.svg" alt="Librezo"/>
</picture> </picture>
</li> </li>
<li><a href="/fonctionnement/">Fonctionnement</a></li> <li><a href="/fonctionnement/">Fonctionnement</a></li>