position-absolute-center-001.html (1179B)
1 <!DOCTYPE html> 2 <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/4659"> 3 <link rel="help" href="https://drafts.csswg.org/css-align-3/#abspos-sizing"> 4 <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> 5 <meta name="assert" content="The available space for a box with center alignment is double the distance between the center of the static position rectangle and the closest edge of the containing block in the relevant axis."> 6 <style> 7 #containing-block { 8 position: relative; 9 width: 100px; 10 height: 100px; 11 background: red; 12 display: flex; 13 } 14 15 #containing-block > div { 16 flex-grow: 1; 17 } 18 19 #inner-flex { 20 display: flex; 21 justify-content: center; 22 } 23 24 span { 25 display: inline-block; 26 inline-size: 50px; 27 block-size: 10px; 28 } 29 </style> 30 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 31 <div id="containing-block" style="flex-direction: row;"> 32 <div id="inner-flex" style="margin: 10px; height: 100px;"> 33 <div style="position: absolute; top: 0; height: 100px; background: green;"> 34 <span></span> 35 <span></span> 36 </div> 37 </div> 38 <div style="height: 100px; background: green;"></div> 39 </div>