popover
{{HTMLSidebar("Global_attributes")}}
The popover
global attribute is used to designate an element as a popover element.
Popover elements are hidden via display: none
until opened via an invoking/control element (i.e. a <button>
or <input type="button">
with a popovertarget
attribute) or a {{domxref("HTMLElement.showPopover()")}}
call.
When open, popover elements will appear above all other elements in the {{glossary("top layer")}}
, and won’t be influenced by parent elements’ {{cssxref('position')}}
or {{cssxref('overflow')}}
styling.
A popover attribute can have values "auto"
(default) or "manual"
.
Popovers that have the auto
state can be “light dismissed” by selecting outside the popover area, and generally only allow one popover to be displayed on-screen at a time.
By contrast, manual
popovers must always be explicitly hidden, but allow for use cases such as nested popovers in menus.
For detailed information on usage, see the {{domxref("Popover API", "Popover API", "", "nocode")}}
landing page.
Examples
The following renders a button that will open a popover element when activated.
<button popovertarget="my-popover">Open Popover</button>
<div popover id="my-popover">Greetings, one and all!</div>
{{EmbedLiveSample('Examples', 600, 200)}}
[!NOTE] See our Popover API examples landing page to access the full collection of MDN popover examples.
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
{{domxref("Popover API", "Popover API", "", "nocode")}}
popovertarget
HTML attributepopovertargetaction
HTML attribute::backdrop
CSS pseudo-element:popover-open
CSS pseudo-class