| <!DOCTYPE html> |
| <script> |
| if (window.internals) { |
| internals.settings.setCSSStickyPositionEnabled(true); |
| } |
| </script> |
| |
| <html> |
| <head> |
| <style> |
| body { |
| margin: 0; |
| width: 2000px; |
| overflow: hidden; /* hide scrollbars */ |
| } |
| |
| p { |
| position: relative; |
| left: 100px; |
| } |
| |
| .group { |
| position: relative; |
| width: 500px; |
| height: 200px; |
| } |
| |
| .container { |
| width: 400px; |
| height: 180px; |
| outline: 2px solid black; |
| } |
| |
| .box { |
| width: 200px; |
| height: 180px; |
| } |
| |
| .sticky { |
| position: sticky; |
| left: 100px; |
| background-color: green; |
| } |
| |
| .indicator { |
| position: absolute; |
| top: 0; |
| left: 0; |
| background-color: red; |
| } |
| </style> |
| <script> |
| function doTest() |
| { |
| window.scrollTo(100, 0); |
| } |
| window.addEventListener('load', doTest, false); |
| </script> |
| </head> |
| <body> |
| <p>Block</p> |
| <div class="group" style="left: 100px"> |
| <div class="indicator box" style="left: 100px;"></div> |
| <div class="container"> |
| <div class="sticky box"></div> |
| </div> |
| </div> |
| |
| <p>Table</p> |
| <div class="group" style="left: 100px"> |
| <div class="indicator box" style="left: 100px;"></div> |
| <div class="container"> |
| <div class="sticky box" style="display: table"></div> |
| </div> |
| </div> |
| |
| <p>Grid</p> |
| <div class="group" style="left: 100px"> |
| <div class="indicator box" style="left: 100px;"></div> |
| <div class="container"> |
| <div class="sticky box" style="display: grid"></div> |
| </div> |
| </div> |
| |
| <p>Flex box</p> |
| <div class="group" style="left: 100px"> |
| <div class="indicator box" style="left: 100px;"></div> |
| <div class="container"> |
| <div class="sticky box" style="display: flex"></div> |
| </div> |
| </div> |
| <div style="position: absolute; top: 500px;"> |
| This test checks the behavior of position:sticky with various display values. |
| There should be no red. |
| </div> |
| </body> |
| </html> |