JSFiddle - React, Tailwind, and code Playground
by Andrea Biagi
CSS
nav label{
padding:1.5em 2em;
color:red;
display:block;
}
nav label:hover{
background-color:green;
}
input:checked ~ nav label{
}
input:checked ~ nav label:after{
border-top:0 solid rgba(255,255,255,.5);
border-bottom:4px solid rgba(255,255,255,.5);
transition:border-top .1s, border-bottom .1s .1s;
}
/*hide the inputs*/
input{display:none}
/*style for the second level menu*/
.submenu{
max-height:0;
padding:0;
overflow:hidden;
background:#444;
box-shadow:0 0 1px rgba(0,0,0,.3);
transition:max-height 0.5s ease-out;
min-width:100%;
}
/*show the second levele menu of the selected voice*/
input:checked ~ .submenu{
max-height:300px;
transition:max-height 0.5s ease-in;
}
.submenu li a{
display:block;
padding:12px;
color:#ddd;
text-decoration:none;
box-shadow:0 -1px rgba(0,0,0,.5) inset;
transition:background .3s;
white-space:nowrap;
}
.submenu li a:hover{
background:rgba(0,0,0,.3);
}