no-anchor-anchor-center-ref.html (581B)
1 <!doctype html> 2 <title>Tests that 'anchor-center' behaves as 'center' when no anchor in containing block</title> 3 <style> 4 .anchor { 5 background: orange; 6 width: 100px; 7 background-color: orange; 8 } 9 .container { 10 position: fixed; 11 top: 20px; 12 left: 50px; 13 width: 300px; 14 height: 200px; 15 display: flex; 16 background: green; 17 justify-content: center; 18 } 19 .target { 20 position: absolute; 21 margin: 0 auto; 22 width: 80px; 23 border: 1px #000 solid; 24 background: lime; 25 } 26 </style> 27 <div class="anchor">anchor</div> 28 <div class="container"> 29 <div class="target">target 1</div> 30 </div>