Skip to content

Popover

Any element with the popover attribute, opened by a button with popovertarget. No JavaScript.

The popover fades in over the page, centered by default. Clicking outside or pressing Esc closes it.

Popover

Click outside or press Esc to close.

Placement

data-placement anchors the popover to its button: bottom, top, left or right. It flips to the other side when there is no room. Browsers without anchor positioning keep it centered.

Below the button
Above the button
Before the button
After the button

Older browsers

Browsers without the Popover API show the content in place, as normal page content.

The navbar menu and the toast are popovers too. For a short label on hover, use a tooltip.

Variables

VariableDefault
--i-popover-max-width20rem
--i-popover-offsetGap between an anchored popover and the button that opens itcalc(var(--i-spacing) * 0.25)
--i-popover-durationvar(--i-duration)
--i-popover-color-backgroundvar(--i-dropdown-color-background)
--i-popover-color-bordervar(--i-dropdown-color-border)
--i-popover-shadowvar(--i-dropdown-shadow)
--i-popover-color-textvar(--i-dropdown-color-text)