一、HTML中的href屬性:
The <a> tag is used to create an anchor to link from, the href attribute is used to address the document to link to, and the words between the open and close of the anchor tag will be displayed as a hyperlink.
<a >Visit W3Schools!</a>
備注: 三、HTML中的name屬性: The name attribute is used to create a named anchor. When using named anchors we can create links that can jump directly into a specific section on a page, instead of letting the user scroll around to find what he/she is looking for. 備注: Always add a trailing slash to subfolder references. If you link like this: , you will generate two HTTP requests to the server, because the server will add a slash to the address and create a new request like this: Named anchors are often used to create "table of contents" at the beginning of a large document. Each chapter within the document is given a named anchor, and links to each of these anchors are put at the top of the document. If a browser cannot find a named anchor that has been specified, it goes to the top of the document. No error occurs.
1). 像href=”
2). 如果href屬性的值以/開頭,則表示相對于服務器的根目錄,如果沒有則表示相對于當前頁面
二、HTML中的target屬性:
With the target attribute, you can define where the linked document will be opened.
<a href="
You should notice that a named anchor is not displayed in a special way.To link directly to the "tips" section, add a # sign and the name of the anchor to the end of a URL.
<a name="tips">Useful Tips Section</a>
一個被錨標記標注的文本并不會有什么特別的顯示,要想使用錨標記進行頁間跳轉,只需要在URL的末尾加上一個#號和錨標記的名稱就可以了。如果是進行頁內跳轉則簡單地使用#號加錨標記的名稱就可以了(連URL都不用了)。
<a >
Jump to the Useful Tips Section
</a>
<a href="#tips">Jump to the Useful Tips Section</a>
四、關于超鏈接的一些注意點:
-------------------------------------------------------------
生活就像打牌,不是要抓一手好牌,而是要盡力打好一手爛牌。