freeCodeCamp/guide/chinese/html/tutorials/how-to-use-links/index.md

39 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: How to Use Links
localeTitle: 如何使用链接
---
## 如何使用链接
在HTML中您可以使用`<a>`标签创建链接。例如,您可以编写`<a href="https://www.freecodecamp.org/">freeCodeCamp</a>`来创建指向freeCodeCamp网站的链接。
几乎所有网页都有链接。链接允许用户在页面之间单击他们的方式。
HTML链接是超链接。您可以单击链接并跳转到另一个文档。
当您将鼠标移到链接上时,鼠标箭头将变成一只小手。
注意链接不必是文本。它可以是图像或任何其他HTML元素。
在HTML中链接使用标记定义
```html
<a href="url">link text</a>
```
```html
<a href="https://www.freecodecamp.org/">Visit our site for tutorials</a>
```
href属性指定链接的目标地址https://www.freecodecamp.org
链接文本是可见部分(访问我们的网站获取教程)。
单击链接文本将发送到指定的地址。
#### 更多信息:
* [MDN - HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) 参考