From 0c93eac82732728e4dbf6b761c7ec16488ba19ee Mon Sep 17 00:00:00 2001 From: James Stuckey Weber Date: Wed, 15 May 2024 12:49:05 -0400 Subject: [PATCH 1/3] Support list of anchor names --- index.html | 33 ++++++++++++++++++++ public/anchor-name-list.css | 15 ++++++++++ src/parse.ts | 29 ++++++++++-------- tests/unit/parse.test.ts | 60 +++++++++++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+), 13 deletions(-) create mode 100644 public/anchor-name-list.css diff --git a/index.html b/index.html index 890339a3..4368a4be 100644 --- a/index.html +++ b/index.html @@ -29,6 +29,7 @@ + @@ -664,6 +665,38 @@

right: anchor(--my-anchor-update right); top: anchor(--my-anchor-update bottom); } + +
+

+ + Use a list of anchor names +

+
+
Anchor
+
Target A
+
Target B
+
+

+ With polyfill applied: Target A is positioned at Anchor's top left + corner. Target B is positioned at Anchor's bottom right corner. +

+
#my-anchor-name-list {
+  anchor-name: --my-anchor-name-a, --my-anchor-name-b;
+}
+
+#my-target-name-list-a {
+  position: absolute;
+  right: anchor(--my-anchor-name-a left);
+  bottom: anchor(--my-anchor-name-a top);
+}
+
+#my-target-name-list-b {
+  position: absolute;
+  left: anchor(--my-anchor-name-b right);
+  top: anchor(--my-anchor-name-b bottom);
+}
+