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