In this chapter, we're going to focus on creating links.
Without links, there would be no World Wide Web,
so it's really hard to overstate how important they are to HTML.
Thankfully, links are incredibly easy to create.
Before we get into the specific exercises, I wanted to take a moment and
introduce you to the anchor element, which is used to create links within your sites.
Now, the first time that somebody encounters the anchor element,
it's usually kind of confusing for them.
I mean, to create a link to a page,
you might think that you would need to use the link element, right?
Well, that would seem to make sense,
but it's not what the link element is used for.
Instead, the link element is used to request external resources for the page.
So, in the code snippet that you're seeing here, it's requesting a CSS file.
So, to create a link on the page,
we use the rather awkwardly named, anchor element.
Thankfully its syntax is fairly easy to grasp.
You simply surround the content that you want to make into a clickable link
with an anchor tag, or as it's commonly referred to, the a tag.
Next, you add an href attribute that tells the browser where you'd like it to
go when the link is clicked.
Here's a little bit of interesting web trivia for you, href stands for
hypertext reference.
Most designers worked for years without knowing what that stands for, and by then,
they usually just shrug their shoulders and don't think too much about it.
Now, before we move on, I want to cover a few more common attributes for
the anchor element as well.
The target attribute is typically used to open a page in a new window or
tab, or to control where a page opens within a frame set.
Frames are not commonly used in modern web design, and
this attribute was actually removed from the HTML specification a while back.
Because it has some value in working with web applications,
the attribute was returned in the latest HTML 5 specification.
The rel attribute describes the relationship of
the target object to the link object.
For example, a rel value of,
next, would indicate that this link is part of a series, and
that the link will take you to the next object or document in the series.
HTML 5 has added the new download attribute.
This indicates that the link is used to download an external resource or
file, such as a PDF or a media file.
This attribute is still rather new, so support for it isn't even, or
even available across the board.
A global attribute that you'll see used frequently with the link,
is the title attribute.
This helps make links more accessible by giving the link a title, which can be
read and interpreted by assistive devices, search engines or other content readers.
It's almost always a good idea to use a title attribute when creating a link to
another page or resource.
So, that covers some of the basic syntax for creating links.
Now, let's dive in and tackle a few exercises for creating links in our sites.