Skip to content

Instantly share code, notes, and snippets.

@kobitoDevelopment
Created January 19, 2026 04:36
Show Gist options
  • Select an option

  • Save kobitoDevelopment/fb8f8002b73485b91b69b0f5bc2c86e5 to your computer and use it in GitHub Desktop.

Select an option

Save kobitoDevelopment/fb8f8002b73485b91b69b0f5bc2c86e5 to your computer and use it in GitHub Desktop.
.popover-target {
position: absolute;
top: anchor(bottom);
left: anchor(center);
}
<button interestfor="popover1" style="anchor-name: --anchor-el-1">ツールチップ1</button>
<div id="popover1" class="popover-target" style="position-anchor: --anchor-el-1" popover>
<p>ツールチップ1です(他のツールチップが開くと自動で閉じられる)</p>
</div>
<button interestfor="popover2" style="anchor-name: --anchor-el-2">ツールチップ2</button>
<div id="popover2" class="popover-target" style="position-anchor: --anchor-el-2" popover="hint">
<p>ツールチップ2です(他のツールチップが開いても自動で閉じられない)</p>
</div>
<button interestfor="popover3" style="anchor-name: --anchor-el-3">ツールチップ3</button>
<div id="popover3" class="popover-target" style="position-anchor: --anchor-el-3" popover="hint">
<p>ツールチップ3です(他のツールチップが開いても自動で閉じられないが、他のhintが開いた場合は閉じられる)</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment