How To Make A Hyperlink On A Website

Table of contents:

How To Make A Hyperlink On A Website
How To Make A Hyperlink On A Website

Video: How To Make A Hyperlink On A Website

Video: How To Make A Hyperlink On A Website
Video: 12: How to Create Links in HTML | Basics of CSS | Learn HTML and CSS | HTML Tutorial 2024, November
Anonim

Hyperlinks are the foundation on which the structure of the Internet is built. It is these elements of Internet pages that allow you to link the pages of sites into a single network. Let's take a closer look at how hyperlinks are inserted into documents.

Hyperlinks in site pages
Hyperlinks in site pages

Instructions

Step 1

Hypertext links are designed to link text, images, or other page elements to other hypertext documents. All elements of a site page, including links, are created by the browser, which receives detailed instructions from the page code sent to it by the server. This HTML (HyperText Markup Language) code consists of "tags" that describe the type, appearance, and location of all elements of a web page. A standard hyperlink is created by the browser when it encounters in the page code, for example, the following tag: Text link Here is the opening link tag, - the closing tag. The opening tag can contain additional information - "attributes". In this simple link, the href attribute contains the URL of the page or other document that will be requested if a visitor clicks on the link. Sometimes it is not necessary to indicate the full address - if the requested document is located on the server in the same folder (or a subfolder in it), then it is enough to specify only its name or the path to the subfolder. Such addresses are called "relative", they should be written, for example, like this: Text link When you click on this link, the document moreText.html from the same folder will be loaded. And absolute link addresses start with a protocol, for example: Text Link Here "http" (HyperText Transfer Protocol) is the usual address of a document on a network. And if you specify the "mailto" protocol, then the hyperlink will launch your mail program, instead of going to another page: email link In the links to files located on the FTP server, the FTP (File Transfer Protocol)): Link to archive

Step 2

Another hyperlink attribute that indicates to which window this new document should be loaded is spelled "target". If you can enter any correct address in the href attribute, then target can have only four values: _self - the page must be loaded into the same window or frame. "Frames" refers to one part of a window divided into several parts; _parent - if the current page itself was loaded from another window (or frame), then it has a "parent" window. And the _parent value requires that the page that the link points to be loaded into this parent window; _top - the new page needs to be loaded into the same window. If this window is divided into frames, then on loading they will be destroyed, and the new page will be the only frame in this window; _blank - a separate window will be opened to follow the link; For example:

Link will open in a new window

Step 3

It is possible to create a hyperlink to go not to another page, but to a given section of the same document. To indicate such a "destination" in the html-code of the document, an anchor link is used: And the link scrolling the document to this anchor looks like this: Link to the first anchor of the page You can link to anchors not only in this document, but also in others: Anchor in another pageOf course in the html-code of another document such an anchor link with the attribute name = "Anchor1" must exist.

Step 4

A hyperlink can serve not only text, but also other elements of the pages - for example, pictures. The simplest tag that draws a picture looks like this: And for the picture to become a hyperlink, it must be enclosed between the opening and closing link tags:

Recommended: