position-sticky-table-parts.html (1578B)
1 <!DOCTYPE html> 2 <title>Nested position:sticky table elements should render correctly</title> 3 <link rel="match" href="position-sticky-table-parts-ref.html" /> 4 <link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" /> 5 <meta name="assert" content="This test checks that nested position:sticky table elements render correctly" /> 6 7 <script src="../resources/ref-rectangle.js"></script> 8 9 <style> 10 .scroller { 11 position: relative; 12 width: 100px; 13 height: 250px; 14 overflow-x: hidden; 15 overflow-y: auto; 16 } 17 18 .contents { 19 height: 700px; 20 } 21 22 table { 23 border-collapse: collapse; 24 } 25 26 .child, td, th { 27 height: 50px; 28 width: 50px; 29 padding: 0; 30 } 31 32 .child { 33 background: green; 34 } 35 36 table * { 37 position: sticky; 38 top: 5px; 39 } 40 41 .indicator { 42 position: absolute; 43 left: 0; 44 background-color: red; 45 height: 50px; 46 width: 50px; 47 } 48 49 </style> 50 51 <script> 52 window.addEventListener('load', function() { 53 document.body.offsetTop; 54 document.getElementById('scroller1').scrollTop = 150; 55 createIndicatorForStickyElements(document.querySelectorAll('.sticky')); 56 }); 57 </script> 58 59 <div>There should be a green square at the top of the scroll view and no red or blue visible.</div> 60 61 <div id="scroller1" class="scroller"> 62 <div class="contents"> 63 <div class="indicator" style="top: 155px;"></div> 64 <table> 65 <tbody> 66 <tr><td><div class="child"></div></td></tr> 67 <tr><td></td></tr> 68 <tr><td></td></tr> 69 <tr><td></td></tr> 70 <tr><td></td></tr> 71 <tr><td></td></tr> 72 <tr><td></td></tr> 73 </tbody> 74 </table> 75 </div> 76 </div>