JSFiddle - React, Tailwind, and code Playground
HTML
<ul>
<li><a href="#" class="active">Home</a></li>
<li><a href="#">work</a></li>
<li><a href="#">Others</a></li>
</ul>
CSS
body {
width: 100%;
line-height: 1;
}
header {
background: #fff;
width: 100%;
height: 76px;
position: fixed;
top: 0;
left: 0;
z-index: 100;
}
a.active {
color: red;
}
nav {
float: right;
padding: 20px;
}
ul {
list-style: none;
}
li {
display: inline-block;
float: left;
padding: 10px
}
.current {
color: #333333;
}
@media only screen and (max-width : 640px) {
header {
position: absolute;
}
#menu-icon {
display:inline-block;
}
nav ul, nav:active ul {
display: none;
position: absolute;
padding: 20px;
background: #fff;
border: 5px solid #444;
right: 20px;
top: 60px;
width: 50%;
border-radius: 4px 0 4px 4px;
}
nav li {
text-align: center;
width: 100%;
padding: 10px 0;
margin: 0;
}
nav:hover ul {
display: block;
}
}
JavaScript
$(document).ready(function(e) {
$("ul li a").click(function(){
$("ul li a").removeClass("active");
$(this).addClass("active");
});
});