blob: 68e62e54790c9398b0e022e5a7f1514bcc6683dd (
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
44
45
46
47
48
49
50
51
52
53
54
|
<!DOCTYPE html>
<title>Tests `anchor` function for top/left/bottom/right properties</title>
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#propdef-anchor-name">
<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>
<style>
#container {
position: relative;
}
#a1 {
anchor-name: --a1;
background: orange;
margin-left: 100px;
margin-top: 100px;
width: 100px;
height: 100px;
}
#a2 {
anchor-name: --a2;
background: purple;
margin-left: 500px;
margin-top: 100px;
width: 100px;
height: 100px;
}
#target {
background: green;
position: absolute;
left: anchor(--a1 right);
top: anchor(--a1 bottom);
right: anchor(--a2 left);
bottom: anchor(--a2 top);
}
#ref {
background: red;
position: absolute;
left: 200px;
top: 100px;
width: 300px;
height: 100px;
}
</style>
<body onload="checkLayout('#target')">
<div id="container">
<div id="a1"></div>
<div id="a2"></div>
<div id="ref"></div>
<div id="target"
data-offset-x=200 data-offset-y=100
data-expected-width=300 data-expected-height=100></div>
</div>
</body>
|