This is fairly complicated and has a few features, so it might be best to watch the original Kevin Powell turorial: https://www.youtube.com/watch?v=DNXEORSk4GU menu popover

Anchor positioning popover content to a button

IMPORTANT NOTE: as of Sept. 2025 anchor positioning only works in Chromium browsers. There is a polyfill: https://github.com/oddbird/css-anchor-positioning, BUT IT DOES NOT WORK RELIABLY AT ALL, SO ANCHOR POSITIONING CANNOT BE USED YET. FIREFOX AND SAFARI SAY THEY WILL BE IMPLEMENTING SUPPORT IN FALL 2025

NOTE THAT THE THING YOU WANT TO TRIGGER THE HIDE SHOW CONTENT MUST HAVE "popovertarget" attribute set to the same name as the dialog element's (or whatever element you use) id for the content you want to show/hide. The content you want to show or hide must also have the attribute "popover" on it. THE BROWSER AUTOMATICALLY HIDES THE ELEMENT WITH THE "popover" element on it when the page loads. It then adds an "open" attribute to the content you want to hide and show when there is a click on the button with the popovertarget attribute on it.

UserName838 email@address.com Manage Account Sign out