The :popover-open
CSS pseudo-class represents a popover element (i.e. one with a popover
attribute) that is in the showing state. You can use this to apply style to popover elements only when they are shown.
Examples
By default, popovers appear in the middle of the viewport. The default styling is achieved like this in the UA stylesheet:
[popover] {
position: fixed;
inset: 0;
width: fit-content;
height: fit-content;
margin: auto;
border: solid;
padding: 0.25em;
overflow: auto;
color: CanvasText;
background-color: Canvas;
}
To override the default styles and get the popover to appear somewhere else on your viewport, you could need to override the above styles with something like this:
:popover-open {
width: 200px;
height: 100px;
position: absolute;
inset: unset;
bottom: 5px;
right: 5px;
margin: 0;
}
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
:popover-open |
114 |
114 |
114 |
No |
100 |
17 |
114 |
114 |
No |
No |
17 |
No |