tor-browser

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

anchor-center-offset-change.html (1119B)


      1 <!DOCTYPE html>
      2 <title>CSS Anchor Positioning Test: Dynamically change the anchor-center position</title>
      3 <link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#anchor-center">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <style>
      7  #cb {
      8    position: relative;
      9    width: 200px;
     10    height: 200px;
     11  }
     12  #anchor {
     13    width: 100px;
     14    height: 100px;
     15    anchor-name: --anchor;
     16  }
     17  #anchored {
     18    position: absolute;
     19    width: 100px;
     20    height: 100px;
     21    position-anchor: --anchor;
     22    align-self: anchor-center;
     23    left: anchor(--unknown right, 0px);
     24  }
     25 </style>
     26 <div id="cb">
     27  <div id="anchor"></div>
     28  <div id="anchored"></div>
     29 </div>
     30 <script>
     31  test(() => {
     32    assert_equals(anchored.offsetLeft, 0);
     33    assert_equals(anchored.offsetTop, 0);
     34  }, "Anchored initially have the same width as the anchor");
     35 
     36  test(() => {
     37    anchor.style.height = "200px";
     38    assert_equals(anchored.offsetLeft, 0);
     39    assert_equals(anchored.offsetTop, 50);
     40  }, "Increase the height of the anchor to move the anchor-center offset");
     41 </script>