Files
webprogrammierung/css/navbar.css
T
2026-05-11 10:22:02 +02:00

150 lines
3.1 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
CSS für den Block Navbar mit seinen Elementen nach BEM
*/
.nav {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #333d43;
padding: 0 1rem;
}
.nav__left,
.nav__right {
display: flex;
align-items: center;
}
.nav__logo img {
height: 3rem;
}
.nav__center {
display: flex;
align-items: center;
}
.nav__item {
position: relative;
margin: 0 0.5rem;
}
.nav__dropdown-toggle {
background: none;
border: none;
cursor: pointer;
font-weight: 600;
padding: 0.5rem 1rem;
color: #fff;
text-decoration: none;
}
.nav__dropdown-menu {
display: none;
position: absolute;
top: 100%;
left: 0;
background: #f9f9f9;
min-width: 12rem;
box-shadow: 0 2px 5px rgba(0,0,0,.15);
padding: 0.5rem 0;
}
.nav__dropdown-menu a {
padding: 0.5rem 1rem; /* Abstand um den Text */
color: #333;
text-decoration: none;
font-weight: 600;
}
.nav__link {
display: inline-block;
font-weight: 600;
background: none;
border: none;
cursor: pointer;
padding: 0.5rem 1rem;
color: #fff;
text-decoration: none;
}
.nav__button {
display: inline-block;
background: #fff;
border: none;
border-radius: 4px;
padding: 0.5rem 1rem;
cursor: pointer;
color: #333;
text-decoration: none;
font-weight: 600;
margin-left: 0.5rem;
}
.nav__search {
display: flex;
align-items: center;
border-radius: 4px; /* Abgerundete Ecken */
background: #fff;
margin: 0 0.5rem;
}
.nav__dropdown:hover .nav__dropdown-menu {
display: block;
}
/* CSS von https://responsivenavigation.net/examples/simple-toggle/ */
.anchor-link,
#mobile-nav { display: none; } /* Nicht im DesktopView */
@media (max-width: 48em) { /* ~768px */
/* DesktopMenü verstecken */
.nav__center { display: none; }
/* HamburgerButton sichtbar */
#mobile-nav,
.anchor-link { display: block; }
/* MobileNavListe (der “offcanvas”‑Menu) sichtbar */
.nav__mobile-menu {
display: block;
position: absolute;
top: 100%;
left: 0;
right: 0;
background: #333d43;
z-index: 999; /* über allem anderen */
max-height: 0; /* verstecken */
overflow: hidden;
transition: max-height 0.3s ease-out;
}
.nav__mobile-menu.open {
max-height: 100vh; /* 100% viewportheight */
overflow-y: auto; /* Scrollen, falls zu viele Links */
}
/* MobileLinks */
.nav__mobile-menu ul {
list-style: none;
margin: 0;
padding: 0;
}
.nav__mobile-menu li {
border-bottom: 1px solid #444;
}
.nav__mobile-menu a {
display: block;
color: #fff;
padding: 1rem;
text-decoration: none;
}
/* Die “Profil / Anmelden / Registrieren”‑Buttons in einer Zeile */
.nav__right {
flex: 1;
justify-content: flex-end;
}
.nav__left {
flex: 1;
}
}