<div class="containing-block">
<div class="tooltip">Anchor me!</div>
<div class="anchor">The anchor</div>
</div>
@import "https://unpkg.com/open-props/open-props.min.css";
@import "https://unpkg.com/open-props/normalize.min.css";
* {
box-sizing: border-box;
}
body {
font-family: "Google Sans", sans-serif;
display: grid;
place-items: center;
min-height: 100vh;
background: var(--surface-2);
color: var(--text-1);
}
.containing-block {
position: relative;
}
.tooltip {
position: absolute;
bottom: calc(100% + 10px);
left: 50%;
transform: translateX(-50%);
box-shadow: var(--shadow-4);
padding: var(--size-4);
white-space: nowrap;
border-radius: var(--radius-2);
font-weight: var(--font-weight-6);
background: var(--surface-1);
border: 1px solid var(--surface-3);
}
.anchor {
background: var(--blue-4);
text-align: center;
font-weight: bold;
border-radius: var(--radius-2);
padding: var(--size-2);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.