Re: [csswg-drafts] [css-anchor-1] Could anchor positioning work for defining the targets of sticky elements? (#8905)

I think this might be a case where wrapping things in sections could help. This way, each sticky element would know where it should stop being stuck.

Something like this (hard-coded modified `top` there): https://codepen.io/kizu/pen/zYMmdMb?editors=1100

```HTML
<main>
  <h1>First-level header</h1>
  <section>
    <h2>Second-level header 1</h2>
  </section>
  <section>
    <h2>Second-level header 2</h2>
    <h3>Third-level header</h3>
  </section>
  <section>
    <h2>Second-level header last</h2>
  </section>
</main>
```

https://github.com/w3c/csswg-drafts/assets/177485/40bba9fb-9633-4cb9-84ca-4b8dfa919165

Now that we have subgrids (and `display: contents`), wrapping content with sections this way should be ok.

-- 
GitHub Notification of comment by kizu
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8905#issuecomment-1652625248 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 26 July 2023 22:31:00 UTC