canvas-as-container-002.html (808B)
1 <!doctype html> 2 <title>CSS Container Queries Test: Absolute positioned canvas as size container for focusable child</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 border: 50px solid green; 9 } 10 canvas { 11 display: block; 12 position: absolute; 13 width: 100px; 14 height: 100px; 15 box-sizing: border-box; 16 container-type: size; 17 } 18 } 19 </style> 20 <p>Test passes if there is a filled green square.</p> 21 <canvas> 22 <div id="target" tabIndex="1"></div> 23 </canvas> 24 <script> 25 requestAnimationFrame(()=> { 26 requestAnimationFrame(()=> { 27 target.focus(); 28 }); 29 }); 30 </script>