JSFiddle - React, Tailwind, and code Playground

by iamthestig

HTML

<body>
    <nav>
         <ul class="nav">
             <li><a href="#">Home</a></li>
             <li class="products">
                 <a href="#">Products</a>
                     <ul class="subnav-products clearfix">
                         <li><a href="#">Product One</a></li>
                         <li><a href="#">Product Two</a></li>
                         <li><a href="#">Product Three</a></li>
                         <li><a href="#">Product Four</a></li>
                         <li><a href="#">Product Five</a></li>
                         <li><a href="#">Product Six</a></li>
                     </ul>
             </li>
             <li><a href="#">Services</a></li>
             <li><a href="#">About Us</a></li>
             <li><a href="#">Contact Us</a></li>
        </ul>             
    </nav>
</body>

CSS

* {
    margin: 0;
    padding: 0;
}

body {
    width: 100%;
    height: 100%;
    background: darkgray;
}

.nav {
    width: 100px;
    position: absolute;
    top: 30px;
    right: 20px;
    list-style: none;
}

.nav li {
    margin: 0 0 10px 0;
    font-family: Helvetica;
    font-size: 11px;
    text-align: right;
    text-transform: uppercase;
    line-height: 1;
}

.nav li:nth-child(5) {
    margin: 0;
}

.nav li a {
    padding: 10px 10px 10px 0;
    color: white;
    text-decoration: none;
    background: dimgray;
    display: block;
    position: relative;
}

.subnav-products {
    width: 300px;
    height: 400px;
    background: silver;
    position: absolute;
    top: 41px;
    left: -300px;
    display: none;
}
.subnav-products li {
    width: 150px;
    margin: 0;
    text-align: center;
    float: left;
}

.subnav-products li a {
    display:block;
}

.clearfix:before,
.clearfix:after {
    content: " "; /* 1 */
    display: table; /* 2 */
}

.clearfix:after {
    clear: both;
}

JavaScript

$(".products").on("click", function(){
        $(".subnav-products").slideToggle();
        $(this).toggleClass("active");
    });