3 ms·
Opening a popup needs JS though.
by grishka 2mo ago
Opening a popup needs JS though.
- nozzlegear 2mo agoNot with the new popover API.
- grishka 2mo agoThis doesn't look like it gives websites something they couldn't do before with CSS and JS.
- nozzlegear 2mo agoI'm pretty sure it does but maybe I'm wrong, I had never tried to create popovers/popups using CSS. What's neat[†] about the popovers API is that it doesn't need any JS, you just write a couple of HTML attributes and voila, a popover/popup. They will run with JS disabled as well. https://chrisburnell.com/html-can-do-that/ https://chrisburnell.com/html-can-do-that/ [†] Neat for me building things like tooltips and dropdowns into my web apps without using JS; not neat for annoying people with popups.
- grishka 2mo agoThe core trick to making a popover, tooltip, or, really, any kind of overlay element that's anchored to something on the page is putting an element with `position: absolute` inside one with `position: relative`. You can make it display on hover with CSS alone too, if you really want to.