diff options
Diffstat (limited to 'testing/web-platform/tests/css/css-anchor-position/position-try-custom-property.html')
-rw-r--r-- | testing/web-platform/tests/css/css-anchor-position/position-try-custom-property.html | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-anchor-position/position-try-custom-property.html b/testing/web-platform/tests/css/css-anchor-position/position-try-custom-property.html new file mode 100644 index 0000000000..69ca0d12f4 --- /dev/null +++ b/testing/web-platform/tests/css/css-anchor-position/position-try-custom-property.html @@ -0,0 +1,66 @@ +<!DOCTYPE html> +<title>Variable substitution in @position-try rules</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: 195px; + height: 70px; + background: yellow; + border-bottom: 1px solid black; +} +.spacer { + width: 1px; + height: 20px; +} +.anchor1 { + anchor-name: --a1; + margin-left: 45px; + width: 100px; + height: 30px; + background: blue; +} +.target { + position: absolute; + position-try-options: --fallback1; + width: 40px; + height: 15px; + margin: 5px; + background: orange; + --left: anchor(--a1 right); + --top: anchor(--a1 top); +} +.fallback1 { + position-try-options: --fallback1; +} +.fallback2 { + position-try-options: --fallback2; +} +@position-try --fallback1 { + /* Position to the right of the anchor. */ + left: var(--left); + top: var(--top); +} +/* Same as above, but using a shorthand. */ +@position-try --fallback2 { + inset: var(--top) 0px 0px var(--left); +} +</style> +<body onload="checkLayoutForAnchorPos('.target')"> + <div class="cb"> + <div class="spacer"></div> + <div class="anchor1"></div> + <div class="target fallback1" + data-offset-x=150 data-offset-y=25></div> + </div> + <div class="cb"> + <div class="spacer"></div> + <div class="anchor1"></div> + <div class="target fallback2" + data-offset-x=150 data-offset-y=25></div> + </div> +</body> |