Anchor Tags (HTML)

In-page Navigation

Using an #id as your href and either setting the name attribute of an anchor tag or the id of an element, you can navigate immediately within a document via a normal anchor link.

<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" />


Using the download attribute will instruct the browser to download the file enclosed in the value of the download attr. The value is optional.

<a href="file.pdf" download>Download Here</a>
<a href="file.pdf" download="new-filename.pdf">Download Here</a>

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.



Last modified: 202212070107