In my view, the best way to structure it would be like this. Even though everything is enclosed in a <div>
, it still holds semantic value as long as the child elements are correctly structured within the HTML.
div>nav>ul>li {
font-size: 25px;
}
nav>ul>li>ul>li {
font-size: 15px;
}
div>nav {
display: none;
}
div:hover nav {
display: block;
}
ul {
list-style-type: none;
}
<div><span>menu</span>
<nav>
<ul>
<li><span>category 1</span>
<ul>
<li><a>item 1</a></li>
<li><a>item 2</a></li>
<li><a>item 3</a></li>
<li><a>item 4</a></li>
<li><a>item 5</a></li>
</ul>
</li>
<li><span>category 2</span>
<ul>
<li><a>item 1</a></li>
<li><a>item 2</a></li>
<li><a>item 3</a></li>
<li><a>item 4</a></li>
<li><a>item 5</a></li>
</ul>
</li>
<li><span>category 3</span>
<ul>
<li><a>item 1</a></li>
<li><a>item 2</a></li>
<li><a>item 3</a></li>
<li><a>item 4</a></li>
<li><a>item 5</a></li>
</ul>
</li>
</ul>
</nav>
</div>