nav {
background: #eee;
position: relative;
a {
display: inline-block;
padding: 10px;
}
> nav {
position: absolute;
opacity: 0;
width: 100%;
a {
display: block;
}
}
}
.main:hover > .sub {
opacity: 1;
}
<nav class="main">
<a href="#">Menu 1</a>
<a href="#">Menu 2</a>
<a href="#">Menu 3</a>
<nav class="sub">
<a href="#">Menu 2-1</a>
<a href="#">Menu 2-2</a>
</nav>
</nav>
After analyzing the code snippets, it is evident that nav.sub behaves as an absolute element outside of nav.main's box model. However, when hovering over nav.sub, it becomes visible.
This raises the question of what determines the :hover active area—is it based on the element's box generated by HTML structure? Unfortunately, I have been unable to find any references or specifications regarding this matter.