<p>
  Sometimes you just have a lot of text and you would like to <button style="--anchor-name: --tooltip-1;" popovertarget="tooltip" popovertargetaction="toggle">click this!</button> <span id="tooltip" style="--anchor: --tooltip-1;" role="note" popover>
    <span class="popover-inner">
      ✨Peek-a-boo✨<br />I'm a little popover
    </span>
  </span>
  to make a little tooltip pop out.<br />To have the other tooltip, you can also try <button style="--anchor-name: --tooltip-2;" popovertarget="tooltip-2" popovertargetaction="toggle">clicking here!</button>
  <span id="tooltip-2" style="--anchor: --tooltip-2;" role="note" popover>
    <span class="popover-inner">
      sweet🤙<br />I'm the other popover
    </span>
  </span>
</p>
@import url("https://fonts.googleapis.com/css2?family=Quicksand&display=swap");

p button {
  anchor-name: var(--anchor-name);
}

[popover] {
  position: absolute;
  top: anchor(var(--anchor) top);
  left: anchor(var(--anchor) center);
  margin: 0;
  max-width: 300px;
  transform-origin: center;
  transform: translate(-50%, -100%);
  background: none;
  border: none;
  overflow: hidden;
  box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
}

/* Demo styles */

p button {
  font-family: "Quicksand", sans-serif;
  color: #7de2d1;
  font-size: 1.16rem;
  line-height: 1.6;
  display: inline;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  text-decoration: underline;
  cursor: pointer;
}

.popover-inner::after {
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #339989;
  content: "";
}

.popover-inner {
  position: relative;
  display: block;
  background: #339989;
  border-radius: 5px;
  border: none;
  color: #fff;
  padding: 16px;
  text-align: center;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  font-family: "Quicksand", sans-serif;
  font-size: 1.16rem;
  line-height: 1.6;
  color: #fff;
  background: #2b2c28;
}
Run Pen

External CSS

  1. https://codepen.io/jh3y/pen/zYRjgjW.css

External JavaScript

  1. https://codepen.io/jh3y/pen/zYRjgjW.js