HTML link


Release date:2024-02-02 Update date:2024-02-23 Editor:admin View counts:129

Label:

HTML link

HTML uses a hyperlink to connect to another document on the network. Links can be found in almost all web pages. Click the link to jump from one page to another.

HTML hyperlinks

HTML uses the label < a > to set hypertext links.

A hyperlink can be a word, a word, or a group of words, or an image that youcan click to jump to a new document or a part of the current document.

When you move the mouse pointer over a link in a web page, the arrow changesto a small hand.

The href attribute is used in the tag < a > to describe the address of the link.

By default, the link appears in the browser in the following form:

  • An unvisited link is displayed in blue font and underlined.

  • Visited links are displayed in purple and underlined.

  • When you click the link, the link appears red and underlined.

Note: if the CSS style is set for these hyperlinks, the display style will be displayed according to the settings of CSS.

HTML Link Syntax

The linked HTML code is simple. It looks like this:

<a href="*url*">*Link Text* </a>

href property describes the target of the link. .

Example

<a href="https://www.runoob.com/">Visit the Rookie Tutorial</a>

Clicking this hyperlink will take the user to the home page of the rookie tutorial.

Tip: “linked text” does not have to be text. Pictures or other HTML elements can be links.

HTML Link- target attribute

Use target property, you can define where the linked document is displayed.

The following line opens the document in a new window:

Example

<ahref="https://www.runoob.com/"target="\_blank"rel="noopener
noreferrer">Visit the Rookie Tutorial!</a>

HTML Link-id attribute

id property can be used to create a bookmark for an HTML document.

Tip: bookmarks are not displayed in any special way, that is, they are not displayed on the HTML page, so they are hidden from the reader.

Example

Insert ID into the HTML document:

<a id="tips">Useful Tips</a>

Create a link to the “useful hint section (id=” tips “)” in the HTML document:

<a href="#tips">Accessing useful tips section</a>

Alternatively, create a link from another page to the “useful hint section (id=” tips “):

<a href="https://www.runoob.com/html/html-links.html#tips">
Accessing useful tips section</a>

Basic precautions-useful tips

Note: always add a forward slash to the subfolder. If you write the link like this: href= “https://www.runoob.com/html”, two HTTP requests will be made to the server. This is because the server adds a forward slash to this address and creates a new request, like this: href= “https://www.runoob.com/html/”.

HTML Link label

Label

Description

< a >

Define a hyperlink

Powered by TorCMS (https://github.com/bukun/TorCMS).