← All notes

CSS and HTML popover: top-layer UI without a modal dialog

Answer: A popover is any element with a popover attribute, useful for tooltips, alerts, menus, and other layered UI.

How it behaves

The attribute hides the element until you give users a way to open it.

Popovers sit in the top layer, above all other content, but they are not modal.

You can put the attribute on a dialog element to get non-modal dialog semantics plus popover behavior.

A button with the popovertarget attribute can control the popover entirely in HTML.

Baseline highlights

The Popover API has landed across all modern browsers and is part of Baseline.

Promotion to the top layer means you do not have to play around with z-index.

Clicking outside of the popover area will close the popover and return focus.

Opening the popover makes the next tab stop inside the popover.

Hitting the esc key will close the popover and return focus.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Google LLC, Popover and dialog; Google LLC, Popover API lands in Baseline. CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Google LLC, Popover and dialog; Google LLC, Popover API lands in Baseline. CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0.

Cite this

Permanent ID: iil:note:289d1v1b

iinventedlight. 2026. "CSS and HTML popover: top-layer UI without a modal dialog." iinventedlight Library, iil:note:289d1v1b, version of 2026-11-24. https://iinventedlight.com/library/notes/css-popover/. License: CC-BY-4.0.

@misc{iil_note_289d1v1b,
  author = {{iinventedlight}},
  title = {{CSS and HTML popover: top-layer UI without a modal dialog}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-24},
  url = {https://iinventedlight.com/library/notes/css-popover/},
  note = {Permanent ID iil:note:289d1v1b. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/css-popover.md.