hidden-until-found-006-ref.html (827B)
1 <!doctype HTML> 2 <html> 3 <meta charset="utf8"> 4 <title>content-visibility hidden-matchable + scrollIntoView (reference)</title> 5 <link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> 6 <link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#attr-hidden-until-found"> 7 8 <style> 9 .spacer { 10 height: 1000px; 11 background: lightgreen; 12 } 13 #container { 14 width: 150px; 15 height: 150px; 16 background: lightblue; 17 } 18 #target { 19 position: relative; 20 top: 75px; 21 visibility: hidden; 22 23 width: 50px; 24 height: 50px; 25 background: red; 26 } 27 </style> 28 29 <div>top of the page</div> 30 <div class=spacer></div> 31 <div id=container> 32 <div id=target></div> 33 </div> 34 <div class=spacer></div> 35 <div>bottom of the page</div> 36 37 <script> 38 onload = () => document.getElementById("target").scrollIntoView(); 39 </script> 40 </html>