目錄
1。 href 屬性
  2. 名稱屬性
  3. Target attribute
4. Title Attribute
Working of Anchor in HTML
1. HTML code
結論 - HTML 中的錨點
首頁 web前端 html教學 HTML 中的錨點

HTML 中的錨點

Sep 04, 2024 pm 04:38 PM
html html5 HTML Tutorial HTML Properties HTML tags

HTML 錨標記是 HTML 中最重要的元素之一,用於在網站之間導航、從一個頁面移動到另一個頁面、點擊滑鼠開啟某種圖像或文字。它用於定義所包含的超連結的開頭和結尾。大多數情況下,搜尋引擎使用它來定義目標 URL。它內容豐富,並且與登陸頁面更相關。

這些連結在不同的場景中代表不同的意義,例如

  • 帶下劃線且紅色的連結表示活動連結
  • 帶下劃線且紫色的連結表示已訪問過的連結。
  • 帶有下劃線和藍色的連結表示未造訪的連結。

文法:

讓我們來看看定義 的實際語法標籤。

<a href="Link_URL">Link Home</a>
登入後複製

如上所示,語法;包含主要部分連結的標籤,定義如下:

HTML 中的錨點

1。 href 屬性

該屬性用於定義超鏈接,其中的目標地址大家可能很熟悉。超連結可作為網頁文件和目標連結之間的連接器。

  2. 名稱屬性

中的name屬性標籤用於前往頁面的特定點。

  • It’s most useful for defining large pages or to define subdivisions.
  • Example:Homepage So in this example we are adding #tag at the anchor name. it’s helpful to the browser to find or jump to the defined location like home. #name can be placed after the filename.

  3. Target attribute

  • The target attribute is used to define the destination page or the defined target page may be opened.
  • It’s used as a common option that is used by target attributes to link with other pages.
  • If the target attribute defines with a blank value like “target=_blank” then it will open a new tab at the target location.

4. Title Attribute

  • The title attribute is one of the important attributes used to give special attention where one can easily move when they click the link.
  • If the user moves the mouse pointer onto the link reference, the title text which was given into the attribute point will be shown there.
  • It works like a tooltip or details where the link will navigate. This approach makes webpages or documents more user-friendly.

Working of Anchor in HTML

Examples

Here we are going to show some examples having use of actual tag.

1. HTML code

<h4>Examples for Anchor in HTML </h4>
<a href="https://timesofindia.indiatimes.com/">Latest News </a><br><br>
<a href="HTMLcolor.html">Navigate on other File</a><br>
登入後複製

Output:
 HTML 中的錨點

On clicking the latest news, the output is :HTML 中的錨點

 By clicking on the link Navigate on other File” it will show another webpage as:
HTML 中的錨點

2. HTML Code

<h2>Reach to EDUCBA </h2>
<ul>
<li><a href="https://www.educba.com/">Website</a></li>
<li><a href="mailto:[email&#160;protected]">Email US</a></li>
<li><a href="tel:+123456789">Phone</a></li>
</ul>
登入後複製

 Output :

HTML 中的錨點

The output shows some links, and that those links are in blue they are unvisited, the link showing in purple has visited the link and this is used to show the difference in links.

3. HTML Code

<h4>Image and File Demo</h4>
<p><a href="C:\Users\\Sonali\Desktop\jerry.jpeg">Image Demo</a> It will
open image</p>
<a href="./generate-zip?id=4" download="assets.zip">Download File</a>
登入後複製

Output :

HTML 中的錨點

While clicking on image demo it will open the image as:HTML 中的錨點

 While clicking on another link it will download the file as :HTML 中的錨點

結論 - HTML 中的錨點

HTML 中的錨標記用於定義直接導航到目標位置的連結。它基於 hre 屬性、name 屬性、target 屬性等主要元件。 標籤用於內部和外部連結以及絕對和相對 URL。

以上是HTML 中的錨點的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

Java教學
1654
14
CakePHP 教程
1413
52
Laravel 教程
1306
25
PHP教程
1252
29
C# 教程
1225
24
HTML 中的表格邊框 HTML 中的表格邊框 Sep 04, 2024 pm 04:49 PM

HTML 表格邊框指南。在這裡,我們以 HTML 中的表格邊框為例,討論定義表格邊框的多種方法。

HTML 中的巢狀表 HTML 中的巢狀表 Sep 04, 2024 pm 04:49 PM

這是 HTML 中巢狀表的指南。這裡我們討論如何在表中建立表格以及對應的範例。

HTML 左邊距 HTML 左邊距 Sep 04, 2024 pm 04:48 PM

HTML 左邊距指南。在這裡,我們討論 HTML margin-left 的簡要概述及其範例及其程式碼實作。

HTML 表格佈局 HTML 表格佈局 Sep 04, 2024 pm 04:54 PM

HTML 表格佈局指南。在這裡,我們詳細討論 HTML 表格佈局的值以及範例和輸出。

HTML 輸入佔位符 HTML 輸入佔位符 Sep 04, 2024 pm 04:54 PM

HTML 輸入佔位符指南。在這裡,我們討論 HTML 輸入佔位符的範例以及程式碼和輸出。

HTML 有序列表 HTML 有序列表 Sep 04, 2024 pm 04:43 PM

HTML 有序列表指南。在這裡我們也分別討論了 HTML 有序列表和類型的介紹以及它們的範例

HTML onclick 按鈕 HTML onclick 按鈕 Sep 04, 2024 pm 04:49 PM

HTML onclick 按鈕指南。這裡我們分別討論它們的介紹、工作原理、範例以及各個事件中的onclick事件。

在 HTML 中移動文字 在 HTML 中移動文字 Sep 04, 2024 pm 04:45 PM

HTML 中的文字移動指南。在這裡我們討論一下marquee標籤如何使用語法和實作範例。

See all articles