这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<link rel="stylesheet" href="/anchor-absolute.css" />
<link rel="stylesheet" href="/anchor-pseudo-element.css" />
<link rel="stylesheet" href="/anchor-media-query.css" />
<link rel="stylesheet" href="/anchor-scope.css" />
<style>
#my-anchor-style-tag {
anchor-name: --my-anchor-style-tag;
Expand Down Expand Up @@ -1211,6 +1212,54 @@ <h2>
],
});
&lt;/script&gt;</code></pre>
</section>
<section id="anchor-scope" class="demo-item">
<h2>
<a href="#anchor-scope" aria-hidden="true">🔗</a>
Scope an anchor name
</h2>
<div class="demo-elements">
<ul>
<li class="anchor">
<span>List item One</span><span class="arrow">▶</span>
<div class="target scoped-target">Target One</div>
</li>
<li class="anchor">
<span>List item Two</span><span class="arrow">▶</span>
<div class="target scoped-target">Target Two</div>
</li>
<li class="anchor">
<span>List item Three</span><span class="arrow">▶</span>
<div class="target scoped-target">Target Three</div>
</li>
<li class="anchor">
<span>List item Four</span><span class="arrow">▶</span>
<div class="target scoped-target">Target Four</div>
</li>
<li class="anchor">
<span>List item Five</span><span class="arrow">▶</span>
<div class="target scoped-target">Target Five</div>
</li>
</ul>
</div>
<p class="note">
With polyfill applied: Targets are positioned to the right of their
corresponding item's arrow.
</p>
<pre><code class="language-css">#anchor-scope li {
anchor-scope: --anchor-scope;
}

#anchor-scope .arrow {
anchor-name: --anchor-scope;
}

#anchor-scope .target {
position: absolute;
position-anchor: --anchor-scope;
left: anchor(right);
top: anchor(center);
}</code></pre>
</section>
<section id="sponsor">
<h2>Sponsor OddBird's OSS Work</h2>
Expand Down
18 changes: 18 additions & 0 deletions public/anchor-scope.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#anchor-scope li {
display: flex;
justify-content: space-between;
anchor-scope: --anchor-scope;
}

#anchor-scope .arrow {
anchor-name: --anchor-scope;
block-size: 1em;
inline-size: 1em;
}

#anchor-scope .target {
position: absolute;
position-anchor: --anchor-scope;
left: anchor(right);
top: anchor(center);
}
Loading