×

Setting a URL for a Hyperlink [2/13]

The <a> tag without an address makes no sense as such a link points nowhere. That's why the text in the previous task remained unchanged even after you have tagged it.

The address of a link is specified by the href attribute, for example:

<a href="http://keksby.ru">Muffin the Great</a>

This hyperlink points to the http://keksby.ru address on the Web.

To be precise, the href attribute value is a Uniform Resource Locator (URL), but commonly it is called plainly, a web address. There may be many types of URLs: absolute or relative, pointing to a page or a file or an image, with or without an anchor, etc. So, a URL may point to any object on the Internet.

By the way, you have already used a URL when you added external styling files in the Structure of HTML Document course.


Do it
HTML
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Setting a URL for a hyperlink:</title> </head> <body> <h1><a href="http://htmlacademy.org">HTML Academy</a></h1> <a>Courses</a><br> <a>Profile</a> </body> </html>
CSS
HTML Academy
  1. To the first link without an address, add the href attribute with the http://htmlacademy.org/courses value
  2. Then, to the second link, add the href attribute with the /profile value.
Theory Check Next