OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <style> |
| 5 .group { |
| 6 display: inline-block; |
| 7 position: relative; |
| 8 width: 150px; |
| 9 height: 500px; |
| 10 } |
| 11 |
| 12 #overflow { |
| 13 width: 600px; |
| 14 height: 550px; |
| 15 overflow: hidden; |
| 16 border: 1px solid black; |
| 17 position: relative; |
| 18 } |
| 19 |
| 20 .spacer { |
| 21 float: left; |
| 22 width: 10px; |
| 23 height: 500px; |
| 24 } |
| 25 .container { |
| 26 width: 100px; |
| 27 height: 400px; |
| 28 outline: 2px solid black; |
| 29 } |
| 30 |
| 31 .box { |
| 32 width: 100px; |
| 33 height: 200px; |
| 34 } |
| 35 |
| 36 .hash { |
| 37 width: 600px; |
| 38 height: 10px; |
| 39 background-color: gray; |
| 40 position: absolute; |
| 41 border: 0px; |
| 42 } |
| 43 |
| 44 .sticky { |
| 45 position: relative; |
| 46 top: 100px; |
| 47 background-color: green; |
| 48 } |
| 49 </style> |
| 50 </head> |
| 51 <body> |
| 52 <div id="overflow"> |
| 53 <div class="spacer"></div> |
| 54 |
| 55 <div class="group" style="top: -120px"> |
| 56 <div class="container"> |
| 57 <div class="sticky box" style="top: 200px"></div> |
| 58 </div> |
| 59 </div> |
| 60 |
| 61 <div class="group" style="top: -20px"> |
| 62 <div class="container"> |
| 63 <div class="sticky box" style="top: 120px"></div> |
| 64 </div> |
| 65 </div> |
| 66 |
| 67 <div class="group" style="top: 120px"> |
| 68 <div class="container"> |
| 69 <div class="sticky box" style="top: 0"></div> |
| 70 </div> |
| 71 </div> |
| 72 <div id="hash" class="hash" style="top: 0;"> |
| 73 </div> |
| 74 </div> |
| 75 <div style="position: absolute; top: 560px;"> |
| 76 This test checks that sticky positioning when scrolled by fragment. |
| 77 There should be no red. |
| 78 </div> |
| 79 </body> |
| 80 </html> |
| 81 |
OLD | NEW |