canvas-as-container-004.html (894B)
1 <!doctype html> 2 <title>CSS Container Queries Test: Absolute positioned canvas as size container for focusable child with display</title> 3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#size-container"> 4 <link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> 5 <style> 6 @supports (container-type: size) { 7 canvas:focus-within { 8 background-color: green; 9 } 10 canvas { 11 display: block; 12 position: absolute; 13 width: 100px; 14 height: 100px; 15 container-type: size; 16 } 17 #target { display: none; } 18 @container (width = 100px) { 19 #target { display: block; } 20 } 21 } 22 </style> 23 <p>Test passes if there is a filled green square.</p> 24 <canvas> 25 <div id="target" tabIndex="1"></div> 26 </canvas> 27 <script> 28 requestAnimationFrame(()=> { 29 requestAnimationFrame(()=> { 30 target.focus(); 31 }); 32 }); 33 </script>