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