You want to create a multi-level unordered list, with each list item that has children, containing another unordered list. E.G.
<ul class="parent">
<li>
<a href="#">Category</a>
<ul class="child">
<li>
<a href="#">Sub-category</a>
<ul class="grandchild">
<li>
<a href="#">Sub-sub-category</a>
<ul class="great-grandchild">
<li>
<a href="#">sub-sub-sub category</a>
</li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#">Sub-category 2</a>
</li>
</ul>
</li>
<li>Category 2</li>
<li>Category 3</li>
<li>Category 4</li>
<li>Category 5</li>
</ul>
then you would hide all of the children/grandchildren etc with css, and show them on parent:hover/active
ul:not('.parent') {
display: none;
}
ul.parent > li:hover > ul,
ul.child > li:hover > ul,
ul.grandchild > li:hover > ul,
ul.great-grandchild > li:hover > ul {
display: block;
}