JSFiddle - React, Tailwind, and code Playground
HTML
<div id="select">
<p>Select your Answer</p>
<ul>
<li><a href="#">Apple</a></li>
<li><a href="#">Arts and Entertainment</a>
<ul>
<li><a href="#">Amusement</a></li>
<li><a href="#">Art</a></li>
<li><a href="#">Artist</a>
<ul>
<li><a href="#">A</a></li>
<li><a href="#">B</a></li>
</ul></li>
</ul>
</li>
</ul>
</div>
CSS
#select {
border: 1px solid #999;
background-color: rgba(0, 0, 0, 0.1);
position: absolute;
width: 300px;
font-family: Arial, sans-serif;
font-size: 11px;
}
#select:hover {
background-color: #efefef;
}
#select > ul {
display: none;
list-style: none;
}
#select:hover > ul {
display: block;
}
#select > ul ul {
margin-left: 20px;
}
#select > ul a, #select > p {
display: block;
padding: 3px 8px 4px;
color: #333;
text-decoration: none;
}
#select > ul a:hover {
background-color: #ddd;
}