scroller-with-child-ref.html (891B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <style> 5 6 body { margin: 20px; font: 18pt monospace; line-height: 30px; } 7 #scope { overflow: auto; contain: layout; padding: 20px; 8 width: 200px; height: 100px; border: 20px solid #acf; } 9 #part-hide { padding: 10px; visibility: hidden; 10 border: 4px solid orange; width: 150px; height: 180px; 11 margin: 20px 0 0 90px; } 12 #part { position: absolute; top: 66px; will-change: transform; 13 background: #fac; padding: 10px; border: 4px solid orange; 14 width: 150px; height: 180px; margin: 20px 0 0 90px; } 15 16 </style> 17 </head> 18 <body> 19 <div id=scope>World 20 <div id=part-hide></div> 21 </div> 22 <!-- TODO(crbug.com/468277656): The child currently pops out of the 23 scope's clip; this will be addressed by the nesting proposal in: 24 https://github.com/w3c/csswg-drafts/issues/12324 --> 25 <div id=part>child</div> 26 <script> 27 28 scope.scrollBy(40, 24); 29 30 </script> 31 </body> 32 </html>