diff options
Diffstat (limited to 'testing/web-platform/tests/css/css-anchor-position/position-fallback-custom-property.html')
-rw-r--r-- | testing/web-platform/tests/css/css-anchor-position/position-fallback-custom-property.html | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-anchor-position/position-fallback-custom-property.html b/testing/web-platform/tests/css/css-anchor-position/position-fallback-custom-property.html new file mode 100644 index 0000000000..ca709af3de --- /dev/null +++ b/testing/web-platform/tests/css/css-anchor-position/position-fallback-custom-property.html @@ -0,0 +1,68 @@ +<!DOCTYPE html> +<title>Variable substitution in @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> +<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-fallback: --fallback1; + width: 40px; + height: 15px; + margin: 5px; + background: orange; + --left: anchor(--a1 right); + --top: anchor(--a1 top); +} +.fallback1 { + position-fallback: --fallback1; +} +.fallback2 { + position-fallback: --fallback2; +} +@position-fallback --fallback1 { + @try { /* Position to the right of the anchor. */ + left: var(--left); + top: var(--top); + } +} +/* Same as above, but using a shorthand. */ +@position-fallback --fallback2 { + @try { + inset: var(--top) 0px 0px var(--left); + } +} +</style> +<body onload="checkLayout('.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> |