canvas-as-container-001.html (762B)
1 <!doctype html> 2 <title>CSS Container Queries Test: 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 width: 100px; 13 height: 100px; 14 box-sizing: border-box; 15 container-type: size; 16 } 17 } 18 </style> 19 <p>Test passes if there is a filled green square.</p> 20 <canvas> 21 <div id="target" tabIndex="1"></div> 22 </canvas> 23 <script> 24 requestAnimationFrame(()=> { 25 requestAnimationFrame(()=> { 26 target.focus(); 27 }); 28 }); 29 </script>