26 lines
641 B
Markdown
26 lines
641 B
Markdown
---
|
||
title: Href Attribute
|
||
localeTitle: Href属性
|
||
---
|
||
## Href属性
|
||
|
||
Href是“超文本引用”的缩写,是HTML属性。 href属性主要用于`<a>`标签,以指定链接所指向的网页的URL(无论是在同一页面的不同部分,还是在完全不同的网页上)。
|
||
|
||
#### 如何使用
|
||
|
||
`<a href="URL"></a>`
|
||
|
||
#### 例子
|
||
|
||
```html
|
||
|
||
<a href="https://www.freecodecamp.org">This is an absolute URL</a>
|
||
|
||
<a href="index.html">This is a relative URL</a>
|
||
```
|
||
|
||
#### 更多信息:
|
||
|
||
[W3Schools的](https://www.w3schools.com/tags/att_href.asp)
|
||
|
||
[HTMLElementReference](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) |