(Redirected from Links in HTML)

Links are used to connect web pages together. They can do more than link, but for right now, we will focus on the basics.

The tag


A link is denoted by the <a> tag and requires a </a> closing tag. For example:

<a href="">Example</a>

The text in between the <a> tag and the closed </a> tag is the text that the link will be displayed at. The example above will look like Example. The href="" attribute, a characteristic with a value inside the opening HTML tag, is the thing that tells the link where the person is going to go when they click on it. In between the two quotes is the URL of where you want the link to go.



Anchors can be used to create links to specific points in an HTML page.

Firstly, place <a name="Tag"></a> at the spot you want to link to.

Secondly, place <a href="#Tag">Hyperlinked text</a> to create a link on the same page or if its a link from a different page, use <a href="path#Tag">Hyperlinked text</a> e.g., <a href="http://...#Tag">Hyperlinked text</a> .



Tooltips allow revealing details about a link when hovering above it with the mouse pointer: <a href="" title="Example tooltip">Hyperlinked text</a>. Sites use it for previewing the meaning of abbreviations and exact time stamps of a relative time.

This can also be done for plain text with <span title="…"> (demo). For abbreviations, the dedicated <abbr title="…"> tag can be used, which browsers usually highlight with a dotted underline, and line breaks can be inserted with &#10; (demo with line break).

Note that these are not widely supported on mobile devices as of 2021


Learning HTML
Previous: Basic formatting in HTMLNext: Links in HTML