summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-anchor-position/position-try-position-anchor.html
blob: 7355c23f53b6373d3ab1f0f4bee4821eca5d91f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<title>CSS Anchor Positioning Test: @position-try can set position-anchor</title>
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#fallback">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<script src="support/test-common.js"></script>
<style>
  #cb {
    position: relative;
    width: 400px;
    height: 400px;
  }
  .anchor {
    width: 100px;
    height: 100px;
  }
  #anchor-a {
    anchor-name: --a;
    /* Makes #anchored overflow when aligned with right edge */
    margin-left: 100px;
  }
  #anchor-b {
    anchor-name: --b;
  }
  #anchored {
    position: absolute;
    left: anchor(right);
    width: 300px;
    height: 100px;
    position-anchor: --a;
    position-try-options: --pf;
  }
  @position-try --pf {
    position-anchor: --b;
  }
</style>
<body onload="checkLayoutForAnchorPos('#anchored')">
<div id="cb">
  <div id="anchor-a" class="anchor"></div>
  <div id="anchor-b" class="anchor"></div>
  <div id="anchored" data-offset-x="100"></div>
</div>