HTML Link
HTML uses a hyperlink to connect to another document on the web. Links can be found on almost every web page. Click a link to jump from one page to another.
For example:
<html> <head> <meta charset="utf-8"> </head> <body> <a href="http://php.cn/">这个是连接哦</a> </body> </html>
The above code will jump to another specified page when clicked.
HTML hyperlink (link)
A hyperlink can be a word, a word, a group of words, or an image. You can click on these contents to jump to a new page. document or a part of the current document.
When you move the mouse pointer over a link on the web page, the arrow will change into a small hand.
We create links in HTML by using the <a> tag.
There are two ways to use the <a> tag:
By using the href attribute - creating a link to another document
By using the name attribute - creating a link within the document Bookmarks
What is hypertext?
The true power of a markup language lies in its ability to combine collected documents into a complete information base, and to link the document base to other document collections in the world. stand up.
In this way, readers can not only fully control the display of the document on the screen, but also control the order of browsing information through hyperlinks. This is the "HT" in HTML and XHTML - hypertext, which connects the entire web.
Basic knowledge of hypertext
The basic feature of hypertext is that it can hyperlink documents; you can point to other locations, which can be in In the current document, in other documents on the local area network, or in documents anywhere on the Internet. These documents form a tangled web of information. The target document usually has some relationship to its source and enriches the source; link elements in the source convey this relationship to the viewer.
Hyperlinks can be used for various effects. Hyperlinks can be used in tables of contents and topic lists. Viewers can click the mouse on the browser screen or press keys on the keyboard to select and automatically jump to a topic in the document that interests them, or to jump to a completely different collection somewhere in the world. documents.
Hyperlinks can also point the viewer to more information about a topic in the document. For example, "If you want more detailed information, please refer to such-and-such page.". Authors can use hyperlinks to reduce duplication of information. For example, we recommend that creators sign each document with their name. This allows you to use a hyperlink that links the name to a separate document containing an address, phone number, and so on, without having to include complete contact information in each document.
Hyper text (hyper text), or anchor (anchor) according to the standard name, is marked using the <a> tag, which can be expressed in two ways. One type of anchor creates a hotspot in the document that, when activated or selected (usually with the mouse) by the user, causes the browser to link. The browser automatically loads and displays a portion of the same document or another document, or triggers certain Internet service-related actions, such as sending an email or downloading a special file. Another type of anchor creates a mark in the document that can be referenced by a hyperlink.
There are also some mouse-related events associated with hyperlinks. These events can be used in conjunction with JavaScript to produce some exciting effects.
Comments
Both types of anchors use the same tag; perhaps that's why they have the same name. But we have found that it is easier to understand both if you separate them and think of the anchors that provide hotspots and hyperlink addresses as "links" and the anchors used to mark the target parts of the document as "anchors." Type of anchor.
HTML link syntax
The HTML code of the link is very simple. It looks like this:
<a href="url (URL of the linked page)">Link text</a>
HTML link - target attribute
Using the target attribute, you can define where the linked document is displayed.
The following line will open the document in a new window:
<html> <head> <meta charset="utf-8"> </head> <body> <a href=" target="_blank" >这个是连接哦</a> </body> </html>
Compare the previous example and see what the difference is.
HTML Connection - id Attribute
The id attribute can be used to create bookmark tags in an HTML document.
Tips: Bookmarks are not displayed in any special way and are not displayed in HTML documents, so they are hidden from readers.