JSFiddle - React, Tailwind, and code Playground
by msmini5
HTML
<div class="navBarContainer">
<ul class="navigation">
<li class="nav-item"><a href="#">Home</a></li>
<li class="nav-item"><a href="#">Portfolio</a></li>
<li class="nav-item"><a href="#">About</a></li>
<li class="nav-item"><a href="#">Blog</a></li>
<li class="nav-item"><a href="#">Contact</a></li>
</ul>
</div>
<div class="site-wrap">
<div class="headerBar">
<div class="headerBarField">
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger"></label>
</div>
<div class="headerBarField">
Name project
</div>
<div class="headerBarField">
User bt
</div>
</div>
<div class="content">
<h1>Pure CSS Off-Screen Menu</h1>
<h3>Finally, an off-screen menu that doesn't require a bunch of Javascript to work. </h3>
<p>This concept relies on the <code>:checked</code> pseudo-selector as well as the general sibling <code>~</code> selector, so it has decent browser support.</p>
<p>Demo by Austin Wulf. <a href="http://www.sitepoint.com/pure-css-off-screen-navigation-menu">See article</a>.</p>
</div>
</div>
CSS
/* Navigation Menu - Background */
.navBarContainer
{
min-height: 100%;
min-width: 100%;
position: fixed;
top: 0;
bottom: 100%;
left: 0;
z-index: 0;
padding: 0px 4em;
}
.navigation {
list-style: none;
background: #038D98;
position: fixed;
z-index: 0;
}
/* Navigation Menu - List items */
.nav-item {
/* non-critical appearance styles */
width: 200px;
border-top: 1px solid #f2f2f2;
border-bottom: 1px solid #f2f2f2;
}
.nav-item a {
/* non-critical appearance styles */
display: block;
padding: 1em;
/*background: linear-gradient(135deg, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%);*/
color: white;
font-size: 1.2em;
text-decoration: none;
transition: color 0.2s, background 0.5s;
}
.nav-item a:hover {
color: #c74438;
/*background: linear-gradient(135deg, rgba(0,0,0,0) 0%,rgba(75,20,20,0.65) 100%);*/
}
/* Site Wrapper - Everything that isn't navigation */
.site-wrap {
min-height: 100%;
min-width: 100%;
background-color: white;
position: relative;
top: 0;
bottom: 100%;
left: 0;
z-index: 1;
padding: 0px 4em;
}
/* Nav Trigger */
.nav-trigger {
/* critical styles - hide the checkbox input */
/*position: absolute; */
display: none;
clip: rect(0, 0, 0, 0);
}
label[for="nav-trigger"] {
position: fixed;
z-index: 4;
height: 20px;
width: 20px;
cursor: pointer;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' x='0px' y='0px' width='30px' height='30px' viewBox='0 0 30 30' enable-background='new 0 0 30 30' xml:space='preserve'><rect width='30' height='6'/><rect y='24' width='30' height='6'/><rect y='12' width='30' height='6'/></svg>");
background-size: contain;
}
/* Make the Magic Happen */
.nav-trigger + label, .site-wrap {
transition: left 0.2s;
}
.nav-trigger:checked + label {
left: 215px;
}
.nav-trigger:checked ~ .site-wrap {
left: 200px;
box-shadow: 0 0 5px 5px...