This repository has been archived by the owner on Jul 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
anchor-tags-html.html
25 lines (23 loc) · 2.6 KB
/
anchor-tags-html.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta name="description" content=""><!-- Bing --><meta name="msvalidate.01" content="45CBBE1BD8265A2217DFDA630EB8F84A" /><title>Tiny Brain Fans - Anchor Tags (HTML)</title><link rel="stylesheet" href="tinystyle.css"></head><body>
<main id="main"><article id="content"><h1 id="title">Anchor Tags (HTML)</h1><h2>In-page Navigation</h2>
<p>Using an <code>#id</code> as your <code>href</code> and either setting the <code>name</code> attribute of an anchor tag or the <code>id</code> of an element, you can navigate immediately within a document via a normal anchor link.</p>
<pre><code class="language-html"><a href="#bob">Click here to go to bob!</a>
<!-- a bunch of other stuff -->
<a name="bob"></a>
<!-- or -->
<div id="bob">
<img src="pic/of/bob" />
</div>
</code></pre>
<h2>Download</h2>
<p>Using the <code>download</code> attribute will instruct the browser to download the file enclosed in the value of the download attr. The value is optional.</p>
<pre><code class="language-html"><a href="file.pdf" download>Download Here</a>
<a href="file.pdf" download="new-filename.pdf">Download Here</a>
</code></pre>
<p>So far I have not seen the attribute force a download of a file, but I have seen it change the download name of the file re: things like PDFs.</p>
<h2>References</h2>
<ol>
<li><a href="https://stackoverflow.com/questions/23825871/how-to-force-a-download-file-prompt-instead-of-displaying-it-in-browser-with-htm" target="_blank">https://stackoverflow.com/questions/23825871/how-to-force-a-download-file-prompt-instead-of-displaying-it-in-browser-with-htm</a></li>
<li><a href="https://www.w3schools.com/tags/att_a_download.asp" target="_blank">https://www.w3schools.com/tags/att_a_download.asp</a></li>
</ol>
<p class="last-modified">Last modified: 202206101419</p></article></main><footer><nav><a href="index.html">Sitemap</a></nav><div class="social"><p>Built using <a href="http://codeberg.org/milofultz/swiki" target="_blank" rel="noopener noreferrer">{{SWIKI}}</a></p><p><a href="http://codeberg.org/milofultz/" target="_blank" rel="noopener noreferrer">Codeberg</a></p><p><a href="http://milofultz.com/" target="_blank" rel="noopener noreferrer">milofultz.com</a></p><p><a href="https://merveilles.town/@milofultz" target="_blank" rel="me noopener noreferrer">Mastodon</a></p></div></footer></body></html>