| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>position:sticky elements should respect the bottom constraint</title> |
| 3 <link rel="match" href="position-sticky-bottom-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 position:sticky elements obey
their bottom anchor after scrolling" /> |
| 6 |
| 7 <style> |
| 8 .group { |
| 9 display: inline-block; |
| 10 position: relative; |
| 11 width: 150px; |
| 12 height: 250px; |
| 13 } |
| 14 |
| 15 .scroller { |
| 16 position: relative; |
| 17 width: 100px; |
| 18 height: 200px; |
| 19 overflow-x: hidden; |
| 20 overflow-y: auto; |
| 21 } |
| 22 |
| 23 .contents { |
| 24 height: 500px; |
| 25 } |
| 26 |
| 27 .prepadding { |
| 28 height: 200px; |
| 29 } |
| 30 |
| 31 .container { |
| 32 height: 200px; |
| 33 } |
| 34 |
| 35 .filler { |
| 36 height: 100px; |
| 37 } |
| 38 |
| 39 .indicator { |
| 40 background-color: red; |
| 41 position: absolute; |
| 42 left: 0; |
| 43 } |
| 44 |
| 45 .sticky { |
| 46 background-color: green; |
| 47 position: sticky; |
| 48 bottom: 25px; |
| 49 } |
| 50 |
| 51 .box { |
| 52 width: 100%; |
| 53 height: 100px; |
| 54 } |
| 55 </style> |
| 56 |
| 57 <script> |
| 58 window.addEventListener('load', function() { |
| 59 document.getElementById('scroller1').scrollTop = 100; |
| 60 document.getElementById('scroller2').scrollTop = 175; |
| 61 document.getElementById('scroller3').scrollTop = 250; |
| 62 }); |
| 63 </script> |
| 64 |
| 65 <div class="group"> |
| 66 <div id="scroller1" class="scroller"> |
| 67 <div class="indicator box" style="top: 200px;"></div> |
| 68 <div class="contents"> |
| 69 <div class="prepadding"></div> |
| 70 <div class="container"> |
| 71 <div class="filler"></div> |
| 72 <div class="sticky box"></div> |
| 73 </div> |
| 74 </div> |
| 75 </div> |
| 76 </div> |
| 77 |
| 78 <div class="group"> |
| 79 <div id="scroller2" class="scroller"> |
| 80 <div class="indicator box" style="top: 250px;"></div> |
| 81 <div class="contents"> |
| 82 <div class="prepadding"></div> |
| 83 <div class="container"> |
| 84 <div class="filler"></div> |
| 85 <div class="sticky box"></div> |
| 86 </div> |
| 87 </div> |
| 88 </div> |
| 89 </div> |
| 90 |
| 91 <div class="group"> |
| 92 <div id="scroller3" class="scroller"> |
| 93 <div class="indicator box" style="top: 300px;"></div> |
| 94 <div class="contents"> |
| 95 <div class="prepadding"></div> |
| 96 <div class="container"> |
| 97 <div class="filler"></div> |
| 98 <div class="sticky box"></div> |
| 99 </div> |
| 100 </div> |
| 101 </div> |
| 102 </div> |
| 103 |
| 104 <div>You should see three green boxes above. No red should be visible.</div> |
| OLD | NEW |