<button id="popover-trigger" popovertarget="popover">More information</button>

<div id="popover" popover><strong>Why we need this:</strong> We'll send order confirmations and important updates to this email address. Make sure to use an address you check regularly.</div>
#popover-trigger {
  anchor-name: --popover-trigger;
}


#popover {
  --margin: 8px;
  margin: var(--margin);
  position: absolute;
  position-anchor: --popover-trigger;
  inset-area: right;
  max-width: 250px;
  min-width: 200px;
  position-try: --bottom;
  background-color: #fffeca;
  color: blue;
  padding: 12px;
  border-radius: 8px;
}

@position-try --bottom {
  margin: var(--margin); 
  inset-area: bottom;
}

body {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, sans-serif;
}

button {
  background-color: blue;
  border: none;
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 16px;
  border-radius: 3px;
  font-weight: 700;
  padding: 6px 15px;
  cursor: pointer;
}
// const popover = document.querySelector("[popover]");
// const trigger = document.querySelector("[popovertarget]");

// trigger.addEventListener("mouseenter", (event) => {
//   popover.showPopover();
// });

// trigger.addEventListener("mouseleave", (event) => {
//   popover.hidePopover();
// });

Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.