HTML LEARNING PATH
2.6 Connect Web Pages Using Links
WHY
The HTML anchor element makes it possible to link your content to other web pages. Whether you’re building out your navigational menu or adding links within your content, the anchor element provides the location web address, known as a URL, such as http://google.com
.
HOW
In HTML, links or sometimes called hyperlink is defined with the <a> tag called an anchor element and href attribute. Links makes it possible to link your text or image content to other web pages.
The href attribute specifies the URL or destination address (http://google.com
) The link text is the visible part (Search Google.com). Clicking on the link text, will send you to the destination address.
Code sample:
<a href="url">link text</a>
GLOSSARY
Anchor tag <a> describes a link’s destination and the href attribute for the address.
URL, stands for Uniform Resource Locator, is the location address.
TIPS AND RESOURCES
PRACTICE
Add a link to the paragraph tag.
<!DOCTYPE html>
<html>
<head>
<title>My First Website!</title>
<meta name="description" content="Describe the content of your web page here">
<meta name="keywords" content="HTML,CSS,JavaScript">
<meta name="author" content="Your Name">
<meta charset="UTF-8">
</head>
<body>
<section>
<h1>This is the heading</h1>
<p><img src="url" alt="some_text"></p>
<p>This is the paragraph content. <a href="http://www.google.com">Search Google.com</a>
</p>
</section>
</body>
</html>
Save your file.