| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Reference for position:sticky elements should respect the top constraint
when nested</title> |
| 3 |
| 4 <style> |
| 5 .group { |
| 6 display: inline-block; |
| 7 position: relative; |
| 8 width: 150px; |
| 9 height: 300px; |
| 10 } |
| 11 |
| 12 .scroller { |
| 13 position: relative; |
| 14 width: 100px; |
| 15 height: 250px; |
| 16 overflow: auto; |
| 17 } |
| 18 |
| 19 .contents { |
| 20 height: 1000px; |
| 21 } |
| 22 |
| 23 .greenIndicator { |
| 24 background-color: green; |
| 25 position: absolute; |
| 26 left: 0; |
| 27 width: 100px; |
| 28 height: 100px; |
| 29 } |
| 30 |
| 31 .fuchsiaIndicator { |
| 32 background-color: fuchsia; |
| 33 position: absolute; |
| 34 left: 0; |
| 35 width: 100px; |
| 36 height: 50px; |
| 37 } |
| 38 </style> |
| 39 |
| 40 <script> |
| 41 window.addEventListener('load', function() { |
| 42 for (const scroller of document.querySelectorAll('.scroller')) { |
| 43 scroller.scrollTop = 250; |
| 44 } |
| 45 }); |
| 46 </script> |
| 47 |
| 48 <div class="group"> |
| 49 <div class="scroller"> |
| 50 <div class="contents"> |
| 51 <div class="greenIndicator" style="top: 250px;"></div> |
| 52 <div class="fuchsiaIndicator" style="top: 250px;"></div> |
| 53 </div> |
| 54 </div> |
| 55 </div> |
| 56 |
| 57 <div class="group"> |
| 58 <div class="scroller"> |
| 59 <div class="contents"> |
| 60 <div class="greenIndicator" style="top: 325px;"></div> |
| 61 <div class="fuchsiaIndicator" style="top: 350px;"></div> |
| 62 </div> |
| 63 </div> |
| 64 </div> |
| 65 |
| 66 <div class="group"> |
| 67 <div class="scroller"> |
| 68 <div class="contents"> |
| 69 <div class="greenIndicator" style="top: 375px;"></div> |
| 70 <div class="fuchsiaIndicator" style="top: 425px;"></div> |
| 71 </div> |
| 72 </div> |
| 73 </div> |
| 74 |
| 75 <div>You should see three green and fuchsia boxes above. No red should be visibl
e.</div> |
| OLD | NEW |