| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>position:sticky top constraint should behave correctly for <thead>
elements</title> |
| 3 <link rel="match" href="position-sticky-table-thead-top-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 the position:sticky top const
raint behaves correctly for <thead> elements" /> |
| 6 |
| 7 <style> |
| 8 table { |
| 9 border-collapse:collapse; |
| 10 } |
| 11 |
| 12 td, th { |
| 13 padding: 0; |
| 14 } |
| 15 |
| 16 td > div, th > div { |
| 17 height: 50px; |
| 18 width: 50px; |
| 19 } |
| 20 |
| 21 .group { |
| 22 display: inline-block; |
| 23 position: relative; |
| 24 width: 150px; |
| 25 height: 200px; |
| 26 } |
| 27 |
| 28 .scroller { |
| 29 position: relative; |
| 30 width: 100px; |
| 31 height: 150px; |
| 32 overflow-x: hidden; |
| 33 overflow-y: auto; |
| 34 } |
| 35 |
| 36 .prepadding { |
| 37 height: 100px; |
| 38 } |
| 39 |
| 40 .postpadding { |
| 41 height: 250px; |
| 42 } |
| 43 |
| 44 .indicator { |
| 45 position: absolute; |
| 46 background-color: red; |
| 47 left: 0; |
| 48 height: 50px; |
| 49 width: 50px; |
| 50 } |
| 51 |
| 52 .sticky { |
| 53 position: sticky; |
| 54 top: 25px; |
| 55 background-color: green; |
| 56 } |
| 57 </style> |
| 58 |
| 59 <script> |
| 60 window.addEventListener('load', function() { |
| 61 document.getElementById('scroller1').scrollTop = 50; |
| 62 document.getElementById('scroller2').scrollTop = 125; |
| 63 document.getElementById('scroller3').scrollTop = 250; |
| 64 }); |
| 65 </script> |
| 66 |
| 67 <div class="group"> |
| 68 <div id="scroller1" class="scroller"> |
| 69 <div class="indicator" style="top: 100px;"></div> |
| 70 <div class="prepadding"></div> |
| 71 <table> |
| 72 <thead class="sticky"> |
| 73 <tr><th><div></div></th></tr> |
| 74 </thead> |
| 75 <tbody> |
| 76 <tr><td><div></div></td></tr> |
| 77 <tr><td><div></div></td></tr> |
| 78 <tr><td><div></div></td></tr> |
| 79 </tbody> |
| 80 </table> |
| 81 <div class="postpadding"></div> |
| 82 </div> |
| 83 </div> |
| 84 |
| 85 <div class="group"> |
| 86 <div id="scroller2" class="scroller"> |
| 87 <div class="indicator" style="top: 150px;"></div> |
| 88 <div class="prepadding"></div> |
| 89 <table> |
| 90 <thead class="sticky"> |
| 91 <tr><th><div></div></th></tr> |
| 92 </thead> |
| 93 <tbody> |
| 94 <tr><td><div></div></td></tr> |
| 95 <tr><td><div></div></td></tr> |
| 96 <tr><td><div></div></td></tr> |
| 97 </tbody> |
| 98 </table> |
| 99 <div class="postpadding"></div> |
| 100 </div> |
| 101 </div> |
| 102 |
| 103 <div class="group"> |
| 104 <div id="scroller3" class="scroller"> |
| 105 <div class="indicator" style="top: 250px;"></div> |
| 106 <div class="prepadding"></div> |
| 107 <table> |
| 108 <thead class="sticky"> |
| 109 <tr><th><div></div></th></tr> |
| 110 </thead> |
| 111 <tbody> |
| 112 <tr><td><div></div></td></tr> |
| 113 <tr><td><div></div></td></tr> |
| 114 <tr><td><div></div></td></tr> |
| 115 </tbody> |
| 116 </table> |
| 117 <div class="postpadding"></div> |
| 118 </div> |
| 119 </div> |
| 120 |
| 121 <div>You should see three green boxes above. No red should be visible.</div> |
| OLD | NEW |