<div class="header">
    <ul class="navigation">
        <li class="dropdown-item prevent-default menu-item-has-children">
            <a href="#">Articles</a>
            <ul class="sub-menu has-visibility">
                <li><a href="#">Laravel</a></li>
                <li><a href="#">Vue.js</a></li>
                <li><a href="#">CSS</a></li>
                <li><a href="#">HTML</a></li>
                <li><a href="#">JavaScript</a></li>
                <li><a href="#">WordPress</a></li>
            </ul>
        </li>
        <li><a href="#">Projects</a></li>
        <li class="hide-on-mobile"><a href="#">Snippets</a></li>
        <li class="hide-on-mobile"><a href="#">About</a></li>
    </ul>
</div>

<button class="toggle-display">
    Toggle Visibility
</button>
body {
    background: #f6f6f6;
    font-family: 'IBM Plex Sans', sans-serif;
}

a {
    text-decoration: none;
}

.header {
    height: 80px;
    box-shadow: 0 0 8px rgba(0,0,0,0.1);
    background: #fff;
    padding: 0 2rem;
}

.navigation {
    margin: 0;
    padding: 0;
    float: left;

    .dropdown-item > a {
        position: relative;

        &::before {
            content: '';
            width: 4px;
            height: 4px;
            border-right: 2px solid #aaa;
            border-bottom: 2px solid #aaa;
            position: absolute;
            transform: rotate(45deg);
            top: calc(50% - 6px);
            right: -15px;
            font-size: 17px;
            color: rgba(0,0,0,0.5);
        }
    }

    > li {
        list-style: none;
        display: inline-block;
        font-weight: 700;
        font-size: 1rem;
        margin-right: 3rem;
    

        &.current-menu-item {
            position: relative;

            &::before {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                width: 100%;
                border-radius: 0 0 2px 2px;
                height: 6px;
                background: #fff;
            }

            a {
                color: rgba(0,0,0,1);
            }
        }
    }

    > li > a {
        display: inline-block;
        height: 80px;
        line-height: 80px;
        color: rgba(0,0,0,1);
        text-transform: uppercase;
        transition: color 0.3s;
        font-weight: 700;
        font-size: 0.9rem;

        &:hover,
        &:focus {
            color: rgba(0, 0, 0, 0.85);
            text-decoration: none;
        }
    }
    
    .prevent-default > a {
        cursor: default;
        pointer-events: none;
    }

    .menu-item-has-children {
        position: relative;

        &:hover {
            > a {
                color: rgba(0,0,0,0.85);
            }

            .sub-menu {
                opacity: 1;
                transform: perspective(0) rotateX(0); 
                transition: 0.3s;
                z-index: 50;
                visibility: visible;
            }
        }
    }
    
    .sub-menu {
        position: absolute;
        top: 80%;
        left: 0;
        background: #343455;
        border-radius: 2px;
        padding: 15px 20px;
        margin: 0;
        min-width: 160px;
        font-weight: 400;
        opacity: 0;
        transform: perspective(300px) rotateX(-6deg);    
        transform-origin: top;
        
        &.has-visibility {
            visibility: hidden;
        }
        
        &::before {
            content: '';
            display: block;
            position: absolute;
            top: -5px;
            left: 20px;
            width: 0; 
            height: 0; 
            border-left: 5px solid transparent;
            border-right: 5px solid transparent;
            border-bottom: 5px solid #343455;
        }
        
        li {
            list-style: none;
        }
        
        a {
            color: rgba(255,255,255,0.8);
            display: block;
            font-weight: 700;
            font-size: 0.9rem;
            transition: 0.3s;
            padding-top: 7px;
            padding-bottom: 7px;
            
            &:hover,
            &:focus {
                text-decoration: none;
                color: #fff;
                transform: translateX(5px);
            }
        }
    }
}

.hide-on-mobile {
    display: none !important;
    
    @media (min-width: 730px) {
        display: inline-block !important;
    }
}

.toggle-display {
    background: #327def;
    padding: 0.5rem 1rem;
    border: none;
    color: #fff;
    font-weight: 700;
    position: fixed;
    right: 20px;
    bottom: 60px;
    cursor: pointer;
    transition: 0.25s ease;
    
    &:hover,
    &:active,
    &:focus {
        background: darken(#327def, 5%);
        transition: 0.25s ease;
    }
}
View Compiled
document.querySelector('.toggle-display').addEventListener('click', function() {
    document.querySelector('.sub-menu').classList.toggle('has-visibility');
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.