| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 | |
| 3 <html> | |
| 4 <head> | |
| 5 <style> | |
| 6 body { | |
| 7 margin: 0; | |
| 8 width: 2000px; | |
| 9 overflow: hidden; /* hide scrollbars */ | |
| 10 } | |
| 11 | |
| 12 p { | |
| 13 position: relative; | |
| 14 left: 100px; | |
| 15 } | |
| 16 | |
| 17 .group { | |
| 18 position: relative; | |
| 19 width: 500px; | |
| 20 height: 200px; | |
| 21 } | |
| 22 | |
| 23 .container { | |
| 24 width: 400px; | |
| 25 height: 180px; | |
| 26 outline: 2px solid black; | |
| 27 } | |
| 28 | |
| 29 .box { | |
| 30 width: 200px; | |
| 31 height: 180px; | |
| 32 } | |
| 33 | |
| 34 .sticky { | |
| 35 position: sticky; | |
| 36 left: 100px; | |
| 37 background-color: green; | |
| 38 } | |
| 39 | |
| 40 .indicator { | |
| 41 position: absolute; | |
| 42 top: 0; | |
| 43 left: 0; | |
| 44 background-color: red; | |
| 45 } | |
| 46 </style> | |
| 47 <script> | |
| 48 function doTest() | |
| 49 { | |
| 50 window.scrollTo(100, 0); | |
| 51 } | |
| 52 window.addEventListener('load', doTest, false); | |
| 53 </script> | |
| 54 </head> | |
| 55 <body> | |
| 56 <p>Block</p> | |
| 57 <div class="group" style="left: 100px"> | |
| 58 <div class="indicator box" style="left: 100px;"></div> | |
| 59 <div class="container"> | |
| 60 <div class="sticky box"></div> | |
| 61 </div> | |
| 62 </div> | |
| 63 | |
| 64 <p>Table</p> | |
| 65 <div class="group" style="left: 100px"> | |
| 66 <div class="indicator box" style="left: 100px;"></div> | |
| 67 <div class="container"> | |
| 68 <div class="sticky box"></div> | |
| 69 </div> | |
| 70 </div> | |
| 71 | |
| 72 <p>Grid</p> | |
| 73 <div class="group" style="left: 100px"> | |
| 74 <div class="indicator box" style="left: 100px;"></div> | |
| 75 <div class="container"> | |
| 76 <div class="sticky box"></div> | |
| 77 </div> | |
| 78 </div> | |
| 79 | |
| 80 <p>Flex box</p> | |
| 81 <div class="group" style="left: 100px"> | |
| 82 <div class="indicator box" style="left: 100px;"></div> | |
| 83 <div class="container"> | |
| 84 <div class="sticky box"></div> | |
| 85 </div> | |
| 86 </div> | |
| 87 <div style="position: absolute; top: 500px;"> | |
| 88 This test checks the behavior of position:sticky with various display values. | |
| 89 There should be no red. | |
| 90 </div> | |
| 91 </body> | |
| 92 </html> | |
| OLD | NEW |