Learn to use hyperlinks to connect web pages

Learn to use hyperlinks to connect web pages : CREATING A HYPERLINK

Hyperlinks are an important skill to master when building websites as they let the user easily access pieces of content.

Let’s create a web page with a hyperlink.

1) Open up your text-editing program.

Create a new HTML file called links.html.

Type this code into your new file:

<!DOCTYPE html>
<html>
<head>
 <title>Links</title>
</head>
<body>
</body>
</html>

2) Let’s make our hyperlink.

Add an anchor < a > tag with an empty href attribute to the < body > of your page.

Your code will look like this:

<body>
 <a href=" "></a>
</body>

3) Choose a word or phrase to be the text for your hyperlink on your web page.

Put it between your opening and closing < a > tags.

Your code will look like this:

<body>
 <a href=" ">Click here</a>
</body>

4) Now choose the URL you want your hyperlink to connect to.

Set it as the value of your href attribute.

Your code will look like this:

<body>
 <a href="https://www.miltonmarketing.com">
 Click here</a>
</body>

5) Save your HTML file and open it in your web browser.

You will see the text between your < a > tags displayed on screen.

When you click the hyperlink text your web browser will link to your URL.

Sample output of above code:


Click here

Try clicking your newly made link. Notice how it takes over your current window/session. We will get into other tabs/windows shortly.

Connected through code, Choose Your Platform!

About the Author: Bernard Aybout

In the land of bytes and bits, a father of three sits, With a heart for tech and coding kits, in IT he never quits. At Magna's door, he took his stance, in Canada's wide expanse, At Karmax Heavy Stamping - Cosma's dance, he gave his career a chance. With a passion deep for teaching code, to the young minds he showed, The path where digital seeds are sowed, in critical thinking mode. But alas, not all was bright and fair, at Magna's lair, oh despair, Harassment, intimidation, a chilling air, made the workplace hard to bear. Management's maze and morale's dip, made our hero's spirit flip, In a demoralizing grip, his well-being began to slip. So he bid adieu to Magna's scene, from the division not so serene, Yet in tech, his interest keen, continues to inspire and convene.