One of the defining features of the World Wide Web is that pages can be linked together pages can contain
elements that when clicked on take you to another page.
These are called hyperlinks.
So far we've been working with one page in a file called index.
It's tier mail.
Let's add another page and call it page to Dr. tetched here.
And I'll just add some basic content similar to the first page.
Going back to the index page let's add a link to this new page.
We add links using the A R anchor element that we site a glimpse of at the start of this section
to make an area into a link.
We wrap anchor tags around whatever we want to be clickable.
This could be text are an image for example.
So first let's add some text.
And then an anchor tag around the words page two like that the H ref attributes of the anchor tag contains
the address of where you want the link to point to.
In our case the page we just added.
In the browser.
Here's the link.
And note that the default styling for text link is underlined.
Blue text.
And when you put the mouse cursor over the link it changes to a painting hand.
When we click the link it takes us to the page.
We just added.
Note that I didn't put the link around the word here.
Rather around the text page 2 you can make any part of the text you like into a link.
But it's a good idea to make the text link understandable if it's taken out of context of the page.
This is for accessibility reasons.
People who have some sort of disability that are using special browser software like a screen reader
will appreciate it and it'll make your site easier to use.
If it isn't just a collection of links that say click here
we can of course also add links to pages on other websites sometimes referred to as external pages.
By using the full address of the page let's add another link here that links to the Wikipedia entry
about the World Wide Web.
When we click on this link it takes us off our site and onto Wikipedia.
As with many h.t. email elements the anchor element has several optional attributes which are listed
here.
A common one to use is the title attribute which gives the user more information about the link.
If they place the mouse cursor on top of it.
Let's add a title attributes to the link we just added and then in the browser when we hover over the
link we get the contents of the title attribute.
If you have some links that you want to provide further information about then it's generally a good
idea to add some descriptive text in the title attributes like this.