HTML basic tutorial hyperlink

Hyperlinks can be seen everywhere on the website. Open Baidu News and click on a paragraph at will to open the news details page. These are all hyperlinks:

10.png

Next, let’s introduce the detailed knowledge of hyperlinks


##Hyperlinks

## Syntax format:

......

Note:

cannot contain the tag

Common attributes

## href: The address URL of the target file. The URL can be a relative address or an absolute address.
  • target: The display window of the target file.
_blank: Open the target file in a new window.
  • _self: Open the target file in the current window (open by default), equivalent to the "replace" operation.
  • _parent: Open the target file in the parent window.
  • _top: Open the target file in the top-level window.
  • Among the commonly used frame web pages of _parent and _top, we will introduce them later

name: Define the name of the anchor link.

1. Absolute address URL

(1) Remote absolute address

To access remote files, always start with "
http://"domain name and host name."

Example:

    

欢迎加入php.cn

php.cn
淘宝网
百度


(2) Local absolute address (rarely used)

The absolute address to access the local is an absolute address starting with file:///.

Add based on the previous example:

    

欢迎加入php.cn

php.cn
淘宝网
百度 点击查看图片

Note: Please test locally



2. Relative address URL (the path in the project is generally a relative path, please test it locally)


(1) The current file and the target file are in a same-level relationship, and the link address directly writes the target file name.

    

欢迎加入php.cn

图片
(2) The current file and the folder where the target file is located are in a sibling relationship. First look for the "folder name" and then the "file name".

That is, the target file is located at the next level.

    

欢迎加入php.cn

图片

(3) The target file is located in the upper directory. Find the corresponding directory upwards, and then find the file in the directory.

Look up and use the "../" symbol.

"../" represents the upper-level directory

"../../" represents the two-level directories

    

欢迎加入php.cn

图片


3. Special link

(1)、Download link

What kind of files will be prompted for download?

On the other hand, which files and web pages can be executed directly? Such as: .jpg, .png, .gif, .html, .htm, .txt, etc.

Most files cannot be executed directly by the browser. Such as: .doc, .xls, .ppt, .rar, .psd...

If it cannot be executed directly, a download box will appear

    

欢迎加入php.cn

下载

(2), Email link

    

欢迎加入php.cn

有问题的话,请给我们发邮件

(3), ordinary empty link(#)

Step to execute any jump link:

    

欢迎加入php.cn

这是一个空链接


Continuing Learning
||

欢迎加入php.cn

php.cn
淘宝网
百度
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!