HOME > Webdesign > Html: Set Anchor - How It Works

HTML: Set anchor - how it works

HTML is used to define or program the structure of web pages. In the process, the web pages are created in table form. Since HTML5 you can use several new features. However, anchors already existed before, these form the start and end point of a hyperlink.

How to set an anchor in HTML

  1. If you want to refer to a specific heading in your HTML document, you can give that heading a specific ID.
  2. Use the command <h2 id="ichBinEinAnkername"> heading 2 </h2> to set an anchor in the second heading "h2".
  3. Of course you can choose the "id" arbitrarily. This does not have to be "ichBinEinAnkername".
  4. In older HTML versions, the structure is slightly different: (<h2><a name="ichBinEinAnkername"> heading 2 </a></h2>).
  5. Now you can link directly to this anchor in the same HTML document or another. The browser will then jump to that location on the web page.
  6. In the same document, use <a href="#ichBinEinAnkername"> linkname </a>.
  7. In another HTML document, use <a href="url#ichBinEinAnkername> linkname </a>.
  8. Replace url with the appropriate path to the HTML document. If the other document is in the same folder, "documentname.html" is enough, otherwise you have to take the correct path, for example "www.MeineWebseite.de/MeinDokument.html".
In an HTML file you can include several other functions. For example, you have the possibility to create a checkbox.

By Emlen

iPhone: Save data volume - this is how you succeed :: Create Samsung Galaxy s10 screenshot: How to do it
USEFUL LINKS