| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>position:sticky left constraint should behave correctly for <th> el
ements</title> |
| 3 <link rel="match" href="position-sticky-table-th-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 the position:sticky left cons
traint behaves correctly for <th> elements" /> |
| 6 |
| 7 <style> |
| 8 table { |
| 9 border-collapse: collapse; |
| 10 margin-left: 100px; |
| 11 } |
| 12 |
| 13 td, th { |
| 14 padding: 0; |
| 15 } |
| 16 |
| 17 td > div, th > div { |
| 18 height: 50px; |
| 19 width: 50px; |
| 20 } |
| 21 |
| 22 .group { |
| 23 position: relative; |
| 24 width: 250px; |
| 25 height: 150px; |
| 26 } |
| 27 |
| 28 .scroller { |
| 29 position: relative; |
| 30 width: 200px; |
| 31 height: 100px; |
| 32 overflow-x: auto; |
| 33 overflow-y: hidden; |
| 34 } |
| 35 |
| 36 .postpadding { |
| 37 height: 10px; |
| 38 width: 500px; |
| 39 } |
| 40 |
| 41 .indicator { |
| 42 position: absolute; |
| 43 background-color: red; |
| 44 top: 0; |
| 45 height: 50px; |
| 46 width: 50px; |
| 47 } |
| 48 |
| 49 .sticky { |
| 50 position: sticky; |
| 51 left: 25px; |
| 52 background-color: green; |
| 53 } |
| 54 </style> |
| 55 |
| 56 <script> |
| 57 window.addEventListener('load', function() { |
| 58 document.getElementById('scroller1').scrollLeft = 50; |
| 59 document.getElementById('scroller2').scrollLeft = 125; |
| 60 document.getElementById('scroller3').scrollLeft = 250; |
| 61 }); |
| 62 </script> |
| 63 |
| 64 <div class="group"> |
| 65 <div id="scroller1" class="scroller"> |
| 66 <div class="indicator" style="left: 100px;"></div> |
| 67 <table> |
| 68 <tbody> |
| 69 <tr> |
| 70 <th class="sticky"><div></div></th> |
| 71 <td><div></div></td> |
| 72 <td><div></div></td> |
| 73 <td><div></div></td> |
| 74 </tr> |
| 75 </tbody> |
| 76 </table> |
| 77 <div class="postpadding"></div> |
| 78 </div> |
| 79 </div> |
| 80 |
| 81 <div class="group"> |
| 82 <div id="scroller2" class="scroller"> |
| 83 <div class="indicator" style="left: 150px;"></div> |
| 84 <table> |
| 85 <tbody> |
| 86 <tr> |
| 87 <th class="sticky"><div></div></th> |
| 88 <td><div></div></td> |
| 89 <td><div></div></td> |
| 90 <td><div></div></td> |
| 91 </tr> |
| 92 </tbody> |
| 93 </table> |
| 94 <div class="postpadding"></div> |
| 95 </div> |
| 96 </div> |
| 97 |
| 98 <div class="group"> |
| 99 <div id="scroller3" class="scroller"> |
| 100 <div class="indicator" style="left: 250px;"></div> |
| 101 <table> |
| 102 <tbody> |
| 103 <tr> |
| 104 <th class="sticky"><div></div></th> |
| 105 <td><div></div></td> |
| 106 <td><div></div></td> |
| 107 <td><div></div></td> |
| 108 </tr> |
| 109 </tbody> |
| 110 </table> |
| 111 <div class="postpadding"></div> |
| 112 </div> |
| 113 </div> |
| 114 |
| 115 <div>You should see three green boxes above. No red should be visible.</div> |
| OLD | NEW |