no-anchor-anchor-center.html (832B)
1 <!doctype html> 2 <title>Tests that 'anchor-center' behaves as 'center' when no anchor in containing block</title> 3 <link rel="match" href="no-anchor-anchor-center-ref.html"> 4 <link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#valdef-justify-self-anchor-center"> 5 <style> 6 .anchor { 7 anchor-name: --dropdownAnchor; 8 background: orange; 9 width: 100px; 10 background-color: orange; 11 } 12 .container { 13 position: fixed; 14 top: 20px; 15 left: 50px; 16 width: 300px; 17 height: 200px; 18 background: green; 19 } 20 .target { 21 position-anchor: --dropdownAnchor; 22 display: flow; 23 left: 10px; 24 right: 10px; 25 position: absolute; 26 justify-self: anchor-center; 27 width: 80px; 28 border: 1px #000 solid; 29 background: lime; 30 } 31 </style> 32 <div class="anchor">anchor</div> 33 <div class="container"> 34 <div class="target">target 1</div> 35 </div>