anchor-name-004.html (1223B)
1 <!DOCTYPE html> 2 <link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#determining"> 3 <link rel="author" href="mailto:xiaochengh@chromium.org"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/resources/check-layout-th.js"></script> 7 <script src="support/test-common.js"></script> 8 <style> 9 .relpos { 10 position: relative; 11 } 12 .anchor1 { 13 anchor-name: --a1, --a2; 14 width: 30px; 15 height: 10px; 16 background: orange; 17 } 18 .target { 19 position: absolute; 20 height: 10px; 21 background: lime; 22 } 23 #target1 { 24 width: anchor-size(--a1 width); 25 } 26 #target2 { 27 width: anchor-size(--a2 width); 28 } 29 #target3 { 30 width: anchor-size(--a3 width, 11px); 31 } 32 </style> 33 <body onload="checkLayoutForAnchorPos('.target')"> 34 <!-- 35 First two targets should find the same anchor via different names. 36 Third target shouldn't find the anchor, as the name is invalid. 37 --> 38 <div class="relpos"> 39 <div class="anchor1" style="width: 30px"></div> 40 <div class="target" id="target1" data-expected-width=30></div> 41 <div class="target" id="target2" data-expected-width=30></div> 42 <div class="target" id="target3" data-expected-width=11></div> 43 </div> 44 </body>