align-self-with-flex-grid-parent.html (984B)
1 <!DOCTYPE html> 2 <link rel="author" title="David Shin" href="mailto:dshin@mozilla.com"> 3 <link rel="help" href="https://drafts.csswg.org/css-position-3/#abspos-layout"> 4 <link rel="match" href="align-self-with-flex-grid-parent-ref.html"> 5 <meta name="assert" content="Ensures that absolutely positioned elements with non-auto inset are w.r.t. absolute contain block."> 6 <style> 7 .container { 8 position: relative; 9 width: 300px; 10 height: 300px; 11 background: purple; 12 } 13 14 .inner { 15 width: 30px; 16 height: 30px; 17 margin-left: 270px; 18 } 19 20 .flex { 21 display: flex; 22 } 23 24 .grid { 25 display: grid; 26 } 27 28 .abs { 29 position: absolute; 30 width: 100px; 31 height: 100px; 32 inset: 0; 33 /* Should align to the center of .container. */ 34 align-self: center; 35 justify-self: center; 36 background: pink; 37 } 38 </style> 39 40 <div class="container"> 41 <div class="inner flex"> 42 <div class="abs"></div> 43 </div> 44 </div> 45 <br> 46 <div class="container"> 47 <div class="inner grid"> 48 <div class="abs"></div> 49 </div> 50 </div>