snapshot-containing-block-absolute-ref.html (850B)
1 <!DOCTYPE html> 2 <html> 3 <title>View transitions: use snapshot containing block for absolute position (ref)</title> 4 <link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/"> 5 <link rel="author" href="mailto:bokan@chromium.org"> 6 7 <style> 8 :root { 9 background-color: red; 10 } 11 12 body { 13 height: 400vh; 14 } 15 16 #target { 17 position: absolute; 18 bottom: 0px; 19 right: 0px; 20 width: 100px; 21 height: 100px; 22 23 display: flex; 24 justify-content: center; 25 flex-direction: column; 26 align-items: center; 27 28 background: darkseagreen; 29 } 30 31 #view-transition { 32 position: absolute; 33 left: 20px; 34 top: 640px; 35 width: 700px; 36 height: 500px; 37 background-color: limegreen; 38 } 39 40 </style> 41 42 <div id="view-transition"> 43 <div id="target">TARGET</div> 44 </div> 45 46 <script> 47 onload = () => { 48 const scrollTargetY = 600; 49 window.scrollTo(0, scrollTargetY); 50 } 51 </script>