You' added
position:relative
to the
#subnav-content
. That means the
top
is relative to the natural position of the element, which will be beneath the preceding
<a>
element.
position - CSS: Cascading Style Sheets | MDN[
^]
If you want to position it at the top of the container, you need to make two changes:
#sidebar {
...
position: relative;
}
And:
#subnav-content {
position: absolute;
...
}
Demo[
^]