position-sticky-margins-003.html (1071B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Position Test: Test position:sticky element with auto margin in block container</title> 4 <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> 5 <link rel="author" title="Mozilla" href="https://www.mozilla.org/"> 6 <link rel="help" href="https://drafts.csswg.org/css-position/#staticpos-rect"> 7 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1488080"> 8 <link rel="match" href="../../reference/ref-filled-green-100px-square.xht"> 9 <meta name="assert" content="This test verifies that a position:sticky element aligning with 'auto' margin still honors the sticky positioning."> 10 11 <style> 12 #container{ 13 width: 100px; 14 height: 100px; 15 overflow: hidden; 16 background: red; 17 } 18 .block { 19 width: 500px; 20 } 21 .child { 22 width: 100px; 23 height: 100px; 24 background: green; 25 position: sticky; 26 margin-left: auto; 27 right: 0; 28 } 29 </style> 30 31 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 32 <div id="container"> 33 <div class="block"> 34 <div class="child"> 35 </div> 36 </div>