<!-- Please follow this checklist and put an x in each of the boxes, like this: [x]. It will ensure that our team takes your pull request seriously. --> - [x] I have read [freeCodeCamp's contribution guidelines](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/CONTRIBUTING.md). - [x] My pull request has a descriptive title (not a vague title like `Update index.md`) - [x] My pull request targets the `master` branch of freeCodeCamp.
22 lines
660 B
Markdown
22 lines
660 B
Markdown
---
|
|
title: Href Attribute
|
|
---
|
|
## Href Attribute
|
|
|
|
Href is short for "Hypertext Reference" and is an HTML attribute. The href attribute is mainly used for `<a>` tags to specify the URL for a webpage the link leads to (whether it be on a different section of the same page, or on a completely different webpage).
|
|
|
|
#### How to use
|
|
`<a href="URL"></a>`
|
|
|
|
#### Examples
|
|
```html
|
|
<a href="https://www.freecodecamp.org">This is an absolute URL</a>
|
|
|
|
<a href="index.html">This is a relative URL</a>
|
|
```
|
|
|
|
#### More Information:
|
|
[W3Schools](https://www.w3schools.com/tags/att_href.asp)
|
|
|
|
[HTMLElementReference](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
|