keyword
Anchors visible — CSS reference
Conditionally hides a positioned element when the relevant anchor is fully clipped or otherwise not visible under the specification’s anchor visibility rules. This example scrolls the anchor out of its own scrollport; it is not a general occlusion detector.
Formal Syntax & Structure
css syntaxcss
position-visibility: anchors-visible;Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>anchors-visible</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}#stage{position:relative;width:300px;height:220px;background:#f1f5f9;outline:1px solid #64748b}#a{position:absolute;left:100px;top:70px;width:60px;height:30px;padding:0;anchor-name:--trigger}#b{position:absolute;position-anchor:--trigger;width:80px;height:45px;background:#2563eb;color:white;box-sizing:border-box;padding:4px}#sc{position:relative;width:220px;height:100px;overflow:auto}#space{position:relative;height:300px}#a{top:20px;left:50px}#b{top:anchor(bottom);left:anchor(left);position-visibility:anchors-visible}#go{position:absolute;top:180px}</style><body><div id="stage"><div id="sc"><div id="space"><div id="a">Anchor</div></div></div><div id="b">Note</div><button id="go" onclick="document.querySelector('#sc').scrollTop=120">Scroll anchor away</button></div></body></html>