Hi everyone,
it's time for me to get some help again.
It's about the same navBar element that I've already asked for help with on another project a while ago. Now I'm reusing this element, but it's gonna drive me crazy.
The issue now is that the new website I'm working on has a centered fixed max-width of 60em, as you can see here:
1. Now I have to adjust the navBar element to max-width: 60em as well, so that the navBar fits to the rest of the page. This turned out to be impossible though, with all my attempts I broke another part of the navBar. If you copy the code into a document and render it in a browser you'll see what I mean.
## NavBar:
I would be extremely grateful if someone would take care of this issue. On an end note, please remember I'm a beginner with this all and I like to learn, so any general suggestions for code improvements are highly welcomed.
it's time for me to get some help again.
It's about the same navBar element that I've already asked for help with on another project a while ago. Now I'm reusing this element, but it's gonna drive me crazy.
The issue now is that the new website I'm working on has a centered fixed max-width of 60em, as you can see here:
Code:
html {
font-family: Georgia, Ubuntu, Roboto;
margin: 0;
line-height: 1.15;
word-wrap: break-word;
-webkit-text-size-adjust: 100%;
-moz-text-size-adjust: 100%;
text-size-adjust: 100%;
background-color: #f0f0f0;
scroll-behavior: smooth;
}
body {
margin: 0 auto;
min-height: 100vh;
max-width: 60em;
border: 1px solid #222;
border-radius: 0;
background-color: #fff;
line-height: 1.4;
}
1. Now I have to adjust the navBar element to max-width: 60em as well, so that the navBar fits to the rest of the page. This turned out to be impossible though, with all my attempts I broke another part of the navBar. If you copy the code into a document and render it in a browser you'll see what I mean.
## NavBar:
Code:
<!DOCTYPE html>
<html lang="de" >
<head>
<meta charset="UTF-8">
<title>NavBar Debugging</title>
<style>
body {
background: #020304;
}
body h1 {
position: fixed;
top: 0.5em;
left: 40px;
z-index: 6;
font-size: 20px;
font-weight: 900;
font-family: sans-serif;
text-transform: uppercase;
color: #222;
}
body input + label {
position: fixed;
top: 1.5em;
right: 40px;
height: 20px;
width: 15px;
z-index: 5;
}
body input + label span {
position: absolute;
width: 100%;
height: 2px;
top: 50%;
margin-top: -1px;
left: 0;
display: block;
background: #020304;
transition: 0.5s;
}
body input + label span:first-child {
top: 3px;
}
body input + label span:last-child {
top: 16px;
}
body label:hover {
cursor: pointer;
}
body input:checked + label span {
opacity: 0;
top: 50%;
}
body input:checked + label span:first-child {
opacity: 1;
transform: rotate(405deg);
}
body input:checked + label span:last-child {
opacity: 1;
transform: rotate(-405deg);
}
body input ~ nav {
background: white;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 4em;
z-index: 3;
transition: 0.5s;
transition-delay: 0.5s;
overflow: hidden;
}
body input ~ nav > ul {
list-style-type: none;
text-align: center;
position: absolute;
top: 15%;
left: 10%;
right: 30%;
}
body input ~ nav > ul > li {
opacity: 0;
transition: 0.5s;
transition-delay: 0s;
}
body input ~ nav > ul > li > a {
text-decoration: none;
text-transform: uppercase;
color: #020304;
font-weight: 700;
font-family: sans-serif;
display: block;
padding: 30px;
}
body input:checked ~ nav {
height: 100%;
transition-delay: 0s;
}
body input:checked ~ nav > ul > li {
opacity: 1;
transition-delay: 0.5s;
}
</style>
</head>
<body>
<h1>Logotext</h1>
<input id="burger" type="checkbox" />
<label for="burger">
<span></span>
<span></span>
<span></span>
</label>
<nav>
<ul>
<li><a href="./index.html" target="_blank">Heimat</a></li>
<li><a href="faq.html" target="_blank">FAQ</a></li>
<li><a href="about.html" target="_blank">Über</a></li>
<li><a href="contact.html" target="_blank">Kontakt</a></li>
<li><a href="content.html" target="_blank">Episoden</a></li>
<li><a href="imprint.html" target="_blank">Impressum</a></li>
<li><a href="privacy.html" target="_blank">Datenschutz</a></li>
</ul>
</nav>
</body>
</html>
I would be extremely grateful if someone would take care of this issue. On an end note, please remember I'm a beginner with this all and I like to learn, so any general suggestions for code improvements are highly welcomed.