try-tactic-back-to-base.html (908B)
1 <!DOCTYPE html> 2 <title>CSS Anchor Positioning: try-tactic, back to base values</title> 3 <link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#typedef-position-try-fallbacks-try-tactic"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <style> 7 #cb { 8 position: absolute; 9 width: 400px; 10 height: 200px; 11 border: 1px solid black; 12 } 13 #target { 14 position: absolute; 15 width: 50px; 16 height: 50px; 17 /* Does not fit ... */ 18 left: 180px; 19 top: 190px; 20 /* ... and neither does this. */ 21 position-try-fallbacks: flip-block; 22 background-color: coral; 23 24 } 25 </style> 26 <div id=cb> 27 <div id=target></div> 28 </div> 29 <script> 30 test(() => { 31 let cs = getComputedStyle(target); 32 assert_equals(cs.left, '180px'); 33 assert_equals(cs.top, '190px'); 34 }, 'Should use base values when nothing fits'); 35 </script>