<header>
<nav>
<button id="nav-toggle" type="button">
<span>Navigation</span>
</button>
<div id="navigation-content">
<ul>
<li><a class="menulink" href="#">Placeholder Link 1</a></li>
<li><a class="menulink" href="#">Placeholder Link 2</a></li>
<li><a class="menulink" href="#">Placeholder Link 3</a></li>
</ul>
</div>
</nav>
<h1>Title</h1>
<p>Some placeholder text</p>
</header>
<main>
<section>
<h2>Section title 1</h2>
<p>Some content</p>
</section>
<section>
<h2>Section title 2</h2>
<p>Some content</p>
</section>
<section>
<h2>Section title 3</h2>
<p>Some content</p>
</section>
</main>
:root {
--dark-blue-color: rgb(0 31 51);
--white-color: rgb(255 215 208);
--menu-border: 3px solid var(--dark-blue-color);
}
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100%;
overflow-x: hidden;
font-size: 1.2em;
background-color: tomato;
color: rgb(32 5 0);
}
ul {
list-style: none;
}
header {
height: 90vh;
display: grid;
background-color: rgb(0 138 169);
}
nav {
margin: 20px;
margin-left: auto;
display: grid;
grid-template-columns: 1fr;
grid-template-rows: repeat(2, 1fr);
justify-items: stretch;
height: 200px;
}
#nav-toggle {
width: 50px;
margin-left: auto;
grid-row: 1 / span 1;
font-size: 1.5em;
height: 50px;
cursor: pointer;
background-color: var(--white-color);
color: var(--white-color);
position: relative;
}
#nav-toggle span {
display: inline-block;
position: absolute;
z-index: -1;
}
#nav-toggle::before,
#nav-toggle::after {
content: "";
position: absolute;
width: 26px;
height: 26px;
top: 10px;
left: 9px;
font-size: 1.5em;
}
#nav-toggle::before {
z-index: -1;
background: linear-gradient(
45deg,
rgb(0 0 0 / 0) 0 42%,
var(--dark-blue-color) 0 58%,
rgb(0 0 0 / 0) 0 100%
),
linear-gradient(
135deg,
var(--white-color) 0 42%,
var(--dark-blue-color) 0 58%,
var(--white-color) 0 100%
);
}
#nav-toggle::after {
background: conic-gradient(
var(--white-color) 0.25turn,
var(--dark-blue-color) 0.25turn 0.5turn,
var(--dark-blue-color) 0.5turn 0.75turn,
var(--dark-blue-color) 0.75turn
) -50px -14px / 96px 10px repeat;
}
#navigation-content {
z-index: -1;
position: relative;
background-color: var(--white-color);
height: 50px;
}
#navigation-content::before,
#navigation-content::after {
content: "";
position: absolute;
top: -51px;
}
#navigation-content::before {
width: calc(100% - 51px);
height: 50px;
z-index: 0;
}
#navigation-content::after {
width: 100%;
height: calc(100% + 51px);
z-index: -1;
cursor: pointer;
}
li {
width: 100%;
border-top: var(--menu-border);
}
#nav-toggle:hover,
#nav-toggle:focus {
outline: var(--menu-border);
color: var(--dark-blue-color);
}
#nav-toggle:focus::before,
nav:focus-within #nav-toggle::before {
z-index: 5;
}
#nav-toggle:focus ~ #navigation-content,
#navigation-content:focus-within {
height: auto;
border: var(--menu-border);
border-top: 0;
box-shadow: -5px 5px 10px var(--dark-blue-color);
right: -3px;
z-index: 10;
}
.menulink {
display: inline-block;
width: 100%;
padding: 0 20px;
color: rgb(32 5 0);
line-height: 50px;
z-index: -1;
text-decoration: none;
}
.menulink:hover,
.menulink:focus {
background-color: var(--dark-blue-color);
color: var(--white-color);
text-decoration: underline;
}
header h1,
header p {
place-self: center;
}
section {
height: 100vh;
}
h1,
h2,
p {
padding: 30px;
text-align: center;
}
/*
* https://css-tricks.com/click-outside-detector/#comment-1770691
*/
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.