# :popover-open

> The `:popover-open` CSS pseudo-class selects a popover element that is currently shown.

## How do I style and animate an open popover in CSS?

The pseudo-class that matches an element with the `popover` attribute while it is displayed. Often used with `@starting-style` and `transition` to animate opening and closing of popovers.

- Topic: Pseudo Classes
- Type: pseudo-class
- Browser support: Chrome 114+, Chrome Android 114+, Edge 114+, Firefox 125+, Firefox Android 125+, Safari 17+, Safari iOS 17+

## Example

Wrong:

```css
[popover] {
  display: block;
  opacity: 0;
}
[popover].open {
  opacity: 1;
}
```

Right:

```css
[popover] {
  opacity: 0;
  transition: opacity 0.2s, display 0.2s allow-discrete, overlay 0.2s allow-discrete;
}
[popover]:popover-open {
  opacity: 1;
}
@starting-style {
  [popover]:popover-open { opacity: 0; }
}
```

`:popover-open` follows the real state, and `@starting-style` with 'allow-discrete' lets the popover fade in and out.

## Common mistakes

- Setting `display: block` on `[popover]`, which keeps it visible when closed.

## Key points

- Popovers use the `popover` attribute and `:popover-open`, not a class toggled by JavaScript.
- Entry styles live in `@starting-style`, and `display` and `overlay` transition with 'allow-discrete'.
- Motion is removed or reduced inside `@media (prefers-reduced-motion: reduce)`.

## Interview questions

### What is the difference between :popover-open and :open?

`:popover-open` matches shown popovers. `:open` covers elements like `<details>`, `<dialog>` and `<select>` and doesn't match popovers.

### How do I style the backdrop behind a popover?

Use `[popover]::backdrop`. It is rendered behind the popover while it is shown in the top layer and is transparent by default.

## Related cards

- [\[popover\]](https://wonderium.dev/html/popover.md)
- [@starting-style](https://wonderium.dev/css/starting-style.md)
- [\[popovertarget\]](https://wonderium.dev/html/popovertarget.md)
- [.showPopover()](https://wonderium.dev/js/show-popover.md)
- [:open](https://wonderium.dev/css/open.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/popover-open
- Last updated: 2026-11-25
