I was to have a dialog automatically show up over my hero section (i.e. announcement).
What's it called? And does Kevin have a video on it? Or maybe point me to some examples.
Thanks
Phil
4 Replies
<dialog>? I dont understand what you're looking for
when you go to a website and a dialog floats in "Limited time offer" what's that behaviour called?
It's a dialog, also called modal
Dialog tag, popover api, or toast notification may help you find what you're looking for. Lkos code example is exactly what you would want if using the
<dialog>
but just as an addition , when styling it in your css make sure you're using the selector
or you will overwrite it's closed state styles. Many people will change its display to flex or grid then wonder why the dialog won't close.
Here's are a couple KPow videos
And Steve Griffith
Mdn popover api
Mdn DialogKevin Powell
YouTube
dialog = the easiest way to make a popup modal
Ever needed to make a modal? Well, we have a native HTML element that does the job with the dialog element! It does a lot of things out of the box that are really awesome, so let’s see how it works!
🔗 Links
✅ Codepen: https://codepen.io/kevinpowell/pen/KKyOYvM
✅ The polyfill: https://github.com/GoogleChrome/dialog-polyfill
✅ a11y modal: htt...
Kevin Powell
YouTube
Styling modals just got easier!
The :modal pseudo-class allows us to style modals nice and easily!
🔗 Links
✅ More on the dialog element: https://youtu.be/TAB_v6yBXIE
⌚ Timestamps
00:00 - Introduction
00:43 - The two different uses for dialog elements
01:36 - Styling the dialog
02:09 - using :modal
#css
--
Come hang out with other dev's in my Discord Community
...
Steve Griffith - Prof3ssorSt3v3
YouTube
Revealing the Differences between HTML Dialogs and the Popover API
The fully supported HTML dialog element and the newly released Popover API have some overlapping functionality but also a lot of unique features. Watch this to understand the differences.
Code from video: https://gist.github.com/prof3ssorSt3v3/f23929f66fb3cd8773f3d7b073df30a6
MDN reference for dialog element: https://developer.mozilla.org/en-U...
MDN Web Docs
: The Dialog element - HTML: HyperText Markup Language | MDN
The HTML element represents a modal or non-modal dialog box or other interactive component, such as a dismissible alert, inspector, or subwindow.