1.6 KiB
1.6 KiB
title | localeTitle |
---|---|
Links | 链接 |
链接
这是一个存根。 帮助我们的社区扩展它 。
链接在网络上的任何地方都使用,目的是将用户引导到各种内容项目。它们通常由光标变为手形图标来指示。链接可以是HTML或网页中包含的文本,图像或其他元素。
您使用code <a>
标签或锚元素来定义链接,这也需要您使用code href
属性访问的目标地址。这是一个片段,使“freeCodeCamp指南”这个短语成为一个链接:
<a href="https://guide.freecodecamp.org">the freeCodeCamp Guide</a>
如果您希望在新标签页中打开链接,则会在开始code <a>
标记内使用code target
属性以及code "_blank"
值。看起来像这样:
<a href="https://guide.freecodecamp.org" target="_blank">the freeCodeCamp Guide</a>
当您需要引导用户访问网页的特定部分时,让我们假设最底层,您首先需要将哈希code #
符号分配给code href
属性,就像这样
<a href="#footer>More about us<a/>
然后,您需要在要引导用户的元素中使用code id
属性 - 在这种情况下,网页底部的code <footer>
。
<footer id="footer">Powered by freeCodeCamp</footer>