95 lines
No EOL
2.9 KiB
HTML
95 lines
No EOL
2.9 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="description" content="">
|
|
<title>heading-anchors Web Component</title>
|
|
<style>
|
|
/* Demo styles */
|
|
body {
|
|
font-family: system-ui, sans-serif;
|
|
}
|
|
.spacer {
|
|
height: 80vh;
|
|
}
|
|
|
|
/* Eliminate layout shift */
|
|
heading-anchors:not(:defined) :is(h2,h3,h4,h5,h6)[id]:after {
|
|
content: "#";
|
|
content: "#" / "";
|
|
padding: 0 .25em;
|
|
visibility: hidden;
|
|
}
|
|
</style>
|
|
<script type="module" src="./heading-anchors.js"></script>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1><heading-anchors> Web Component</h1>
|
|
</header>
|
|
<main>
|
|
<p>Return to the <a href="https://github.com/zachleat/heading-anchors">GitHub Repository</a>.</p>
|
|
<heading-anchors>
|
|
<h2 id="heading-2">Heading 2</h2>
|
|
<p>This is simulated content.</p>
|
|
<h3 id="heading-3">Heading 3</h3>
|
|
<p>This is simulated content.</p>
|
|
<h4 id="heading-4">Heading 4</h4>
|
|
<p>This is simulated content.</p>
|
|
<h2 id="heading-2b">Heading 2b</h2>
|
|
<p>This is simulated content.</p>
|
|
<h2 id="heading-2c" data-ha-exclude>Heading 2c (Skipped)</h2>
|
|
<p>This is simulated content.</p>
|
|
<h2 id="heading-2d">Heading 2d</h2>
|
|
<p>This is simulated content.</p>
|
|
<h2 id="heading-2e">Heading 2e This is a very long header that will wrap This is a very long header that will wrap This is a very long header that will wrap</h2>
|
|
<p>This is simulated content.</p>
|
|
</heading-anchors>
|
|
|
|
<heading-anchors prefix="Ir a la sección titulada">
|
|
<h2 id="i18n">Internationalized accessible link text</h2>
|
|
</heading-anchors>
|
|
|
|
<heading-anchors content="&">
|
|
<h2 id="glyph">Custom Glyph</h2>
|
|
</heading-anchors>
|
|
|
|
<heading-anchors content="&">
|
|
<style>
|
|
#fontfamily { font-family: Georgia }
|
|
</style>
|
|
<h2 id="fontfamily">Override font-family</h2>
|
|
</heading-anchors>
|
|
|
|
<heading-anchors>
|
|
<style>
|
|
#var-settings { font-variation-settings:"wght" 50; }
|
|
</style>
|
|
<h2 id="var-settings">Customize font-variation-settings</h2>
|
|
</heading-anchors>
|
|
|
|
<heading-anchors id="fa-demo" content="">
|
|
<style>
|
|
#fa-demo .ha-placeholder:after,
|
|
#fa-demo .ha:after {
|
|
font-family: "Font Awesome 6 Free";
|
|
/* You can set alt text e.g. `content: "" / "Alt text"` but accessible link text is provided for free */
|
|
content: "\f0c1";
|
|
font-weight: 900;
|
|
-webkit-font-smoothing: antialiased;
|
|
}
|
|
</style>
|
|
<h2 id="fontawesome-heading">Use a Font Awesome icon</h2>
|
|
<p>The above example also shows how to use CSS pseudo elements instead of the `content` attribute.</p>
|
|
|
|
<script src="https://kit.fontawesome.com/97520a8df1.js" defer crossorigin="anonymous"></script>
|
|
</heading-anchors>
|
|
|
|
<div class="spacer"></div>
|
|
<heading-anchors>
|
|
<h2 id="keyboardtab">Tabbing to offscreen anchor</h2>
|
|
</heading-anchors>
|
|
</main>
|
|
</body>
|
|
</html> |