Home >Web >HTML reference – elements and attributes >popover – popover (attribute)

popover – popover (attribute)

<button popovertarget="help">?</button><div id="help" popover>…</div>

Pop-up content: a drop-down menu, help, a notification, a picker. An element with popover is hidden; a button with popovertarget opens and closes it. When open, the element sits in the top layer above the whole page and with the auto value it closes with the Esc key or a click outside – all without a script.

Values

  • auto (or an empty value) – closes with the Esc key, a click outside and by opening another auto popover.
  • manual – closes only with a button or a script (notifications that should stay).
  • hint – help that does not close an open auto popover. Chrome since 151, Firefox since 153, Safari not yet (as of October 2026).
  • Applies to: all elements (the control: a button with popovertarget, optionally popovertargetaction show, hide, toggle)
  • In JavaScript: element.popover, showPopover(), hidePopover(), togglePopover()

Examples

Help for a field opened with a button:

<label for="p-zip">ZIP code</label>
<input id="p-zip" name="zip" inputmode="numeric">
<button type="button" popovertarget="p-help" aria-label="Help with the ZIP code">?</button>
<div id="p-help" popover>
  <p>Five digits, for example 62701.</p>
</div>

The look of an open popover – :popover-open and a translucent background:

<div id="box" popover>…</div>
[popover] {
  padding: 12px 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
}
[popover]::backdrop {
  background: rgb(0 0 0 / 0.1);
}

Accessibility

The browser gives a button with popovertarget the expanded state (aria-expanded) and after the popover closes, focus returns to it. The popover itself has no role – give it one according to its content (role="menu" only for a real menu of commands, otherwise perhaps none).

Things to watch out for

  • By default the popover is placed in the middle of the screen (inset: 0; margin: auto). Attaching it to the button is done with CSS anchor positioning (position-anchor), which not all browsers support yet.
  • An element with popover is hidden with display: none – a rule with display on the same element shows it permanently. Put the display only on :popover-open.
  • For a box that should block the rest of the page (confirming a deletion), use dialog with showModal().

Browser support

Baseline – newly available: in all major browsers since April 2024; older browser versions do not support it. Since version: Chrome 114, Firefox 125, Safari 17. As of October 2026 (MDN browser-compat-data).

Related:
dialog – dialog box
button – button
details – disclosure widget
aria-* – accessibility attributes