Anchor positioning for sub levels in multi level navigation
Hi,
Would it be correct to use anchor positioning (maybe with
popover
for the secondary / tertiary levels in a multiple level hover navigation bar, maybe built with nested <ul>
and <li>
elements?
If so, is there a way to link the anchor and the anchor target without an id, how would you manage the ids here? Would you ahve to add an id to each sub level of the nav?2 Replies
probably? 😄
First thing I'll say is multiple levels need to be accessible from more than only hover, cause mobile, and even on desktop, hover only sub menus are the worst (it's easy to go slightly outside and it goes away).
You can give mupltiple elements the same anchor name, and "scope" it using
position: relative
https://codepen.io/kevinpowell/pen/OPVZwbp
(I used hover just for a very quick proof of concept 😄 )Amazing! Thank you. Yes, I have alternative nav for mobile use, but just wanted to play around with it.