JSFiddle - React, Tailwind, and code Playground
HTML
<div class="fixed-top">
<span class="trigger">hover me</span>
<div class="menu"></div>
</div>
CSS
body {
margin: 0;
}
.fixed-top {
height: 50px;
width: 100%;
padding: 0;
top: 0;
position: fixed;
}
.fixed-top:before {
background: #3b5999;
content:'';
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
z-index: 1;
}
.trigger {
color: white;
font-size: 33px;
margin-left: 50%;
position: relative;
z-index: 2;
}
.trigger:hover + .menu {
margin-top: 0;
}
.menu {
z-index: 0;
height: 300px;
background-color: #1c7754;
width: 400px;
margin: auto;
margin-top: -400px;
transition: all 0.75s ease-out;
}