tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

scroll-target-align-002.html (1872B)


      1 <!DOCTYPE html>
      2 <html>
      3 <title>scrollIntoView() and snap position with snapping off (y-axis)</title>
      4 <link rel='author' title='Elika J. Etemad' href='http://fantasai.inkedblade.net/contact'>
      5 <link rel='help' href='https://www.w3.org/TR/css-scroll-snap-1/#choosing'>
      6 <link rel='match' href='scroll-target-001-ref.html'>
      7 <meta name="flags" content="may">
      8 <meta name='assert'
      9      content="Test passes if scroll snapping is honored
     10               on a scroll container with 'scroll-snap-type: none'
     11               when scrolling an element into view
     12               explicitly by script.">
     13 
     14 <style type='text/css'>
     15  .container {
     16    border: solid blue 4px;
     17    height: 4em;
     18    overflow: auto;
     19 
     20    /* to make failing more obvious */
     21    background: 0 1em / 100% 1em linear-gradient(red, red) repeat-x;
     22    /* avoid anti-aliasing issues */
     23    font: 20px/1 sans-serif;
     24    scrollbar-width: none;
     25  }
     26  .container > div {
     27    height: 1em;
     28  }
     29  .container { scroll-padding: .5em 0 0;  } /* set up a snap position      */
     30  #target    { scroll-margin:  .5em 0 0;
     31               scroll-snap-align: center; }
     32  #stripe    { background: green;         } /* color part of the snap area */
     33  .fail      { color: red;                } /* make failing more obvious   */
     34 
     35  /* emulate `scrollbar-width: none` for browsers that don't support it yet */
     36  ::-webkit-scrollbar { display: none; }
     37 </style>
     38 
     39 <div id='instructions'>Test passes if there is a green stripe across the second quarter of the box below and no red.</div>
     40 
     41 <div class="container">
     42  <div></div>
     43  <div></div>
     44  <div></div>
     45  <div></div>
     46  <div class="fail">FAIL</div>
     47  <div></div>
     48  <div id="stripe"></div>
     49  <div id="target"></div>
     50  <div></div>
     51  <div class="fail">FAIL</div>
     52  <div></div>
     53  <div></div>
     54  <div></div>
     55  <div></div>
     56 </div>
     57 
     58 <script>
     59  document.getElementById('target').scrollIntoView();
     60 </script>