File: anchor-position-grid-001.html

package info (click to toggle)
firefox 143.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,617,328 kB
  • sloc: cpp: 7,478,492; javascript: 6,417,157; ansic: 3,720,058; python: 1,396,372; xml: 627,523; asm: 438,677; java: 186,156; sh: 63,477; makefile: 19,171; objc: 13,059; perl: 12,983; yacc: 4,583; cs: 3,846; pascal: 3,405; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (83 lines) | stat: -rw-r--r-- 2,069 bytes parent folder | download | duplicates (3)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#anchor-pos">
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#anchor-size">
<link rel="author" href="mailto:kojii@chromium.org">
<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;
}
.columns {
  column-count: 3;
  column-fill: auto;
  column-gap: 10px;
  width: 620px;
  height: 100px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, 100px);
  grid-template-rows: 50px 100px;
}
.spacer {
  background: yellow;
}
.anchor1 {
  anchor-name: --a1;
  grid-column: 2;
  grid-row: 2;
  border: 2px solid orange;
  border-width: 5px 6px 7px 8px;
}
.target {
  grid-column: 2;
  grid-row: 2;
  position: absolute;
  width: anchor-size(--a1 width);
  height: anchor-size(--a1 height);
  background: lime;
  opacity: .2;
}
.target1-l {
  left: anchor(--a1 left);
  top: anchor(--a1 top);
  width: 8px;
}
.target1-r {
  right: anchor(--a1 right);
  bottom: anchor(--a1 bottom);
  width: 6px;
}
.target1-t {
  left: anchor(--a1 left);
  top: anchor(--a1 top);
  height: 5px;
}
.target1-b {
  right: anchor(--a1 right);
  bottom: anchor(--a1 bottom);
  height: 5px;
}
</style>
<body onload="checkLayoutForAnchorPos('.target')">
  <div>
    <div class="spacer" style="height: 10px"></div>
    <div class="columns">
      <div class="spacer" style="height: 10px"></div>
      <div class="grid cb">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div class="anchor1"></div>

        <div class="target target1-l" data-offset-x=100 data-expected-height=100></div>
        <div class="target target1-r" data-offset-x=194 data-expected-height=100></div>
        <div class="target target1-t" data-offset-y=50 data-expected-width=100></div>
        <div class="target target1-b" data-offset-y=145 data-expected-width=100></div>
      </div>
    </div>
  </div>
</body>