targeted-column-scroll-marker-selection-002.html (3038B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 4 <head> 5 <meta charset="utf-8"> 6 <title>CSS Test: scroll tracking for ::scroll-markers whose orignatin elements cannot be scroll-aligned </title> 7 <link rel="match" href="targeted-column-scroll-marker-selection-002-ref.html"> 8 <link rel="help" href="https://drafts.csswg.org/css-overflow-5/#scroll-container-scroll"> 9 <script src="/css/css-transitions/support/helper.js"></script> 10 <script src="/dom/events/scrolling/scroll_support.js"></script> 11 <script src="/common/reftest-wait.js"></script> 12 </head> 13 14 <body> 15 <style> 16 .wrapper { 17 display: grid; 18 justify-content: center; 19 } 20 21 .carousel { 22 width: 800px; 23 height: 200px; 24 overflow-x: scroll; 25 scroll-snap-type: x mandatory; 26 list-style-type: none; 27 scroll-behavior: smooth; 28 border: solid 2px grey; 29 padding-top: 10%; 30 text-align: center; 31 counter-set: markeridx -1; 32 columns: 2; 33 34 &::column::scroll-marker { 35 content: counter(markeridx); 36 counter-increment: markeridx; 37 align-content: center; 38 text-align: center; 39 width: 35px; 40 height: 35px; 41 border-radius: 50%; 42 margin: 3px; 43 background-color: red; 44 } 45 &::column::scroll-marker:target-current { 46 background-color: green; 47 } 48 49 &>.item { 50 scroll-snap-align: center; 51 height: 80%; 52 width: 158px; 53 border: 1px solid; 54 place-content: center; 55 display: inline-block; 56 } 57 58 scroll-marker-group: after; 59 60 &::scroll-marker-group { 61 height: 45px; 62 display: flex; 63 align-items: center; 64 justify-content: center; 65 border: solid 1px black; 66 border-radius: 30px; 67 } 68 } 69 </style> 70 <div class="wrapper" id="wrapper"> 71 <div class="carousel" id="carousel"> 72 <div class="item item0" tabindex=0>0</div> 73 <div class="item item1" tabindex=0>1</div> 74 <div class="item item2" tabindex=0>2</div> 75 <div class="item item3" tabindex=0>3</div> 76 <div class="item item4" tabindex=0>4</div> 77 <div class="item item5" tabindex=0>5</div> 78 <div class="item item6" tabindex=0>6</div> 79 <div class="item item7" tabindex=0>7</div> 80 <div class="item item8" tabindex=0>8</div> 81 <div class="item item9" tabindex=0>9</div> 82 <div class="item item10" tabindex=0>10</div> 83 <div class="item item11" tabindex=0>11</div> 84 <div class="item item12" tabindex=0>12</div> 85 <div class="item item13" tabindex=0>13</div> 86 <div class="item item14" tabindex=0>14</div> 87 <div class="item item15" tabindex=0>15</div> 88 </div> 89 </div> 90 <script> 91 92 const carousel = document.getElementById("carousel"); 93 const items = document.querySelectorAll(".item"); 94 function runTest() { 95 const item4 = items[4]; 96 item4.scrollIntoView(); 97 carousel.onscrollend = () => { takeScreenshot(); }; 98 } 99 waitForCompositorReady().then(runTest); 100 </script> 101 </body> 102 103 </html>