The course is part of this learning path
One of the best parts of HTML is its ability to hyperlink to pretty much anything. This lets you link to external websites, and pages within your own site easily. In this module, you’ll learn how to hyperlink and how to use named anchors to move around pages. After this, you’ll learn about the difference between absolute and relative URLs, and when to use them. We’ll end the module off with a discussion on how to include mailto links on your sites.
The real power of HTML is its ability to include hyperlinks in a document. This is because it gives you the ability to connect any other piece of content or websites to yours, which is extremely useful for users. In text form, a hyperlink is shown in a different color from the rest of the text and is underlined, but images can also have hyperlinks embedded within them.
In this video, I'll take you through how to create basic hyperlinks using the anchor tag and href attributes. Okay, so to create a hyperlink, we'll need the anchor element, which is represented by the a tag. One of the anchor elements attributes is the hypertext reference or href. Aside from this, the container can also include text, which, as I mentioned ago, will normally be highlighted in a different color and underlined so using those as the hyperlink.
Here's a quick example of the anchor attribute in action. So let's say I want to add a hyperlink to a contact page. This might look something like this. So, I've already got the text in, but I need to add the hyperlink, that's pretty easy as I know I want to hyperlink the text that says QA's training on page, so I've got a reference point.
Next, I'll open my anchor tag, then after the href, I'll type equals. Now all I need to do is add the website link inside quotation marks, then closing the opening tag. Now, after the hyperlink text, I close the anchor tag, and just like that, I've got a working hyperlink. So that's the basics of hyperlinking. The anchor element is an awesome tool that will help you create dynamic and useful web pages down the line, and we'll be using it throughout this course.
About the Author