Spec-Zone.ru › CSS

`:popover-open` CSS pseudo-class

Baseline Newly available

This feature works across the latest devices and browser versions. This feature might not work in older devices or browser versions. It's been available across browsers since January 2025.

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.

Syntax

:popover-open {
  /* ... */
}

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

Specification
HTML
# selector-popover-open
Selectors Level 4
# selectordef-popover-open

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on iOS Samsung Internet WebView Android WebView on iOS
popover-open
114
114
125
100
17
114
125
76
17
23.0
114
17

See also

  • Popover API
  • popover HTML global attribute

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/:popover-open

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API