How To Make A Link Code

Table of contents:

How To Make A Link Code
How To Make A Link Code

Video: How To Make A Link Code

Video: How To Make A Link Code
Video: 12: How to Create Links in HTML | Basics of CSS | Learn HTML and CSS | HTML Tutorial 2024, December
Anonim

Everything that the creator placed in the web page is recreated by the visitor's browser based on the HTML instructions that the web server sends. In particular, a hyperlink is displayed on a page when the browser encounters an "A" tag (from the word anchor) in the source code. In this tag, you can specify additional information (tag attributes) that tells the browser details about how the link should look, where to lead, how to respond to hovering, etc.

How to make a link code
How to make a link code

Instructions

Step 1

Include in the link tag only the referral address if you want the design and behavior of this link to be the same as in other similar elements on this page. Such a tag with a minimal set of attributes in HTML (HyperText Markup Language) may look, for example, like this: Text link Here, an href attribute is placed in the opening tag, which contains the full address of the link. Behind the start tag is the link text, followed by the end tag. If the link points to a document located in the same server folder as this page itself, then it is not necessary to indicate the full ("absolute") address. In this case, the link may look, for example, like this: Text link If the document is in a subfolder, then write it like this: Text link Such addresses, as opposed to absolute ones, are called "relative".

Step 2

Place the target attribute on the opening tag of the link to instruct the browser to open the link in a new window. For example, it might look like this: Opens in a new window Here, the _blank value assigned to the target attribute means a new page, and in total this attribute can be assigned four different values. The other three (_self, _parent, and _top) are not often used and apply to pages that use frames or are opened with JavaScript.

Step 3

Use the name attribute if, when clicking on a link, you need to scroll the document to the specified label in the link on this page. Such a label in the HTML code may look like this: This link will not be visible to the visitor, its purpose is only to indicate the place to which the page should be scrolled. And the link to this mark itself should look like this: Link to the first mark If such a mark is not located on the current page, then the link to it may look, for example, like this: Mark in the external page

Step 4

Place other block-level page elements between the start and end link tags if you want to make those elements a link. For example, the HTML code of a link image might look like this:

Recommended: