JSFiddle - React, Tailwind, and code Playground
HTML
<nav>
<div class="t">Lvl 0-1</div>
<div class="c">
<div>Lvl 1-1</div>
<div class="t">Lvl 1-1</div>
<div class="c">
<div>Lvl 2-1</div>
<div>Lvl 2-1</div>
<div>Lvl 2-1</div>
</div>
<div>Lvl 1-1</div>
</div>
<div class="t">Lvl 0-2</div>
<div class="c">
<div>Lvl 1-2</div>
<div class="t">Lvl 1-2</div>
<div class="c">
<div>Lvl 2-2</div>
<div>Lvl 2-2</div>
<div>Lvl 2-2</div>
</div>
<div>Lvl 1-2</div>
</div>
</nav>
CSS
nav {
position: relative;
}
div {
padding: 3px 5px;
}
.t {
position: relative;
cursor: pointer;
}
.c {
position: absolute;
display: none;
left: 0;
width: 200px;
background: #f0f0f0;
}
.t:hover + .c, .t:focus + .c, .c:hover {
display: block;
}
.t {
display: inline-block;
}
.t .t {
display: block;
width: 200px;
}
.c .c {
position: relative;
background: #e0e0e0;
}
.c .t {
width: 200px;
}
/* helper to visualize things */
.t:hover {
background: #eee;
outline: 1px dotted red;
}