Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Opening a popup needs JS though.


Not with the new popover API.


This doesn't look like it gives websites something they couldn't do before with CSS and JS.


I'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/

[†] Neat for me building things like tooltips and dropdowns into my web apps without using JS; not neat for annoying people with popups.


The 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: