Anchoring a pseudo-element to another pseudo-element
I have this demo (warning: uses native carousels & anchoring): https://codepen.io/Venyl/pen/LEVvxaR
Right now the
::before
doesn't see the anchor-name
of the ::scroll-marker-group
and therefore I can't use anchoring, how could I fix this?2 Replies
hmm, I feel like it should work. I don't see anything inheritly wrong with how you set it up.
actually i'm confused now, because I can get some things to anchor to it and not others, which should work...
it seems that, if you use
position: absolute
, you can no longer anchor to that element... which seems wrong. might be a bug, going to look into it
Oh, this is intended I think... " If your anchor is absolutely positioned, make sure it comes before the positioned element in the DOM. "I don't have time to dive further in right now, but this might help:
https://www.oddbird.net/2025/01/29/anchor-position-validity/#troubleshooting-checklist