Try   HackMD

HTML 2. - anchor tag 建立超連結

  • anchor tag:

    如何開始設定超連結?

// 這是一個連結到 food panda 的網址:

// href 是指你要連結到的網址 <a>標籤則是顯示的標題:

<a href="https://www.foodpanda.com.tw/">food panda</a>
  • 但這個直接設定錨點的方式會有一個問題,那就是點了連結之後,網站就會跳轉到目標,而本身的網頁就離開了。

  • 我們更希望的是,保留本身的網頁,而使用者可以透過點下產生出一個新的分頁,該如何執行?

  • anchor tag 的屬性 target="_blank",參考 MdN doc

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


透過 base 來設定,可直接使整個網頁的超連結都開啟新分頁

  • 此做法可以讓你省去或是避免遺忘某個連結沒設定到超連結:
// 直接放在 head 裡,設定 base target 
<head>
    <base target="_blank" />
</head>
tags: 2022 網頁開發全攻略教程