Do the links in HTML always have to be text?


#1

Question

In the context of this exercise, do the links in the HTML always have to be text, or can we make other content into a link?

Answer

You can make other types of content of a page into a link, other than just text.

For most content, including text, you can simply turn them into a clickable link by wrapping them between the opening and closing <a></a> tags. Whatever content is inside of the tags will become a clickable link.

For example, this will turn an image into a clickable link.

<a href="http://www.codecademy.com">
  <img src="www.example.com/image.svg">
</a>

You can also make other HTML elements, such as <p> or <div>, into clickable links. For example,

<a href="http://www.codecademy.com">
  <div>Codecademy</div>
</a>

Feel free to experiment with other types of content and see if they can become links!