HTML uses hyperlinks to connect to another document on the web.
Links can be found in almost all web pages. Click on a link to jump from one page to another.
Let's first look at a link instance
HTML hyperlink (link)
HTML uses the tag <a> to set up hypertext links.
A hyperlink can be a word, a word, or a group of words, or it can be an image that you can click to jump to a new document or a section of the current document.
When you move the mouse pointer over a link in a web page, the arrow turns into a small hand.
The href attribute is used in the tag <a> to describe the address of the link.
For example, if you link to the php.cn site home page, you can say this:
<a href="http://www.php.cn">PHP Chinese Network</a>
By default, links will appear in the browser in the following form:
An non-visited link appears as a blue font with an underscore.
Visited links appear purple and underlined.
When you click on a link , the link appears red and underlined.
Note : If CSS styles are set for these hyperlinks, the presentation style will be displayed according to the CSS settings.
HTML connection - id attribute
The id attribute can be used to create bookmark tags in an HTML document.
Hint: Bookmarks are not displayed in any special way, are not displayed in HTML documents, so they are hidden from the reader.
Insert an ID in the HTML document:
<a id="tips">Useful tips section</a>
Create a link in the HTML document to the "useful hints section (id="tips")":
<a href="#tips">Access the helpful tips section</a>
Or, create a link from another page to the "useful hints section (id="tips")":
Access the helpful tips section</a>
Note: Always add a forward slash to the subfolder. If you write the link like this: href="http://www.php.cn/html", it will generate two HTTP requests to the server. This is because the server adds a forward slash to this address and then creates a new request like this: href="http://www.php.cn/html/".
How to use image links.
The image uses the <img> tag, which will be discussed later.
Click on the image above will jump to http://www.php.cn/ this URL