spacer-and-container-scrolled-ref.html (613B)
1 <!doctype HTML> 2 <html> 3 <meta charset="utf8"> 4 <title>Content Visibility: spacer and a container, scrolled to container (reference)</title> 5 <link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> 6 <link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility"> 7 8 <style> 9 .spacer { 10 width: 150px; 11 height: 300vh; 12 background: lightblue; 13 } 14 #container { 15 width: 150px; 16 height: 150px; 17 background: green; 18 } 19 </style> 20 21 <div class="spacer"></div> 22 <div id="container">Test passes if this is on screen.</div> 23 24 <script> 25 onload = () => container.scrollIntoView(); 26 </script> 27 </html>