JSFiddle - React, Tailwind, and code Playground
by jeryagus
HTML
<div id="navbar">
<div class="logo">DEVILZ COD3</div>
<label for="hide" class="nav-colapse">☰</label>
<input type="checkbox" id="hide">
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Sitemap</li>
<li>contact</li>
<li>menu</li>
</ul>
</nav>
</div>
CSS
*, *:after, *:before {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background:#2e2e2e;
font-family: "Raleway", sans-serif;
}
#navbar {
position: fixed;
width: 100%;
background: rgba(255, 255, 255, 0.8);
padding: 10px;
z-index: 1;
*zoom: 1;
}
#navbar:before, #navbar:after {
content: " ";
display: table;
}
#navbar:after {
clear: both;
}
.logo {
font-size: 1.5em;
font-weight: 700;
background: #5e2e2e;
padding: 5px;
color: white;
float: left;
}
.nav-colapse {
float: right;
font-size: 1.5em;
display: none;
}
nav {
display: block;
float: right;
}
nav ul {
list-style: none;
margin-top: 10px;
margin-right: 18px;
cursor: pointer;
}
nav ul li {
display: inline;
padding: 5px;
font-weight: 300;
border-radius: 3px;
background: #7e2e2e;
color: white;
}
nav ul li:hover {
background: #5e2e2e;
color: white;
}
#hide {
display: none;
}
#hide:checked + nav {
display: block;
}
@media only screen and (max-width: 768px) {
.container {
width: 100%;
}
#navbar {
padding: 10px 0 0 0;
}
.logo {
margin: 0 0 10px 10px;
}
.nav-colapse {
display: block;
margin: 0px 10px 0 0;
float: right;
cursor: pointer;
padding: 0 5px;
color: white;
background: #5e2e2e;
}
nav {
display: none;
float: none;
clear: both;
}
nav ul {
margin-top: 0px;
}
nav ul li {
display: block;
border-radius: 0;
background: rgba(255, 255, 255, 0.1);
color: #37bc9b;
text-align: center;
border-bottom: 1px solid white;
}
}