2018-10-12 19:37:13 +00:00
---
title: How to Use Links
---
## How to Use Links
2018-11-05 04:03:02 +00:00
Links are found in many webpages and its purpose is to allow users to visit other webpages.
2018-10-12 19:37:13 +00:00
2018-11-05 04:03:02 +00:00
< br /> In HTML, you can use the `<a>` tag to create a hyperlink.
2018-10-12 19:37:13 +00:00
```html
< a href = "url" > link text< / a >
```
2018-11-05 04:03:02 +00:00
The href attribute is very important, as it defines what the destination address is.
< br / > The link text is the actual visable text.
2018-10-12 19:37:13 +00:00
2018-11-05 04:03:02 +00:00
< br / > For example, if you wanted something to link to the freeCodeCamp website, you could type:
2018-10-12 19:37:13 +00:00
```html
2018-11-05 04:03:02 +00:00
< a href = "https://www.freecodecamp.org/" > freeCodeCamp< / a >
2018-10-12 19:37:13 +00:00
```
2018-11-05 04:03:02 +00:00
When run, this will display the text "freeCodeCamp", but it links to the website `"https://www.freecodecamp.org"` . Clicking on the text will send you to the specified address. Neat!
2018-10-12 19:37:13 +00:00
2018-11-05 04:03:02 +00:00
### Links in images
2018-10-12 19:37:13 +00:00
2018-11-05 04:03:02 +00:00
Links don't need to only be text. You can add a link to an image as well!
```html
< a href = "https://www.freecodecamp.org"
< img src = "freecodecamp.png" alt = "freeCodeCamp's logo" >
< / a >
```
2018-10-12 19:37:13 +00:00
2018-11-05 04:03:02 +00:00
What we do here is we put an < img > tag inside of an < a > tag. This allows us to click the image to go to the link, which is `https://www.freecodecamp.org` . Double neato!
2018-10-12 19:37:13 +00:00
#### More Information:
<!-- Please add any articles you think might be helpful to read before writing the article -->
* [MDN - HTML <a> Reference ](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a )