Links
Part of the Fundamentals section of Coddy's HTML journey — lesson 21 of 60.
In HTML, a link (or hyperlink) is an element that connects one web page to another.
You can create links to other web pages, files, locations within the same page or any other URL. Links are created using the <a> tag, which stands for anchor.
Here's the basic syntax for creating a link in HTML:
<a href="url">Link text</a><a>: The opening anchor tag.href: The destination URL of the link.
Link text: The visible text that users will see and click on.</a>: The closing anchor tag.
Here's an example of how to create a link to Google's homepage:
<a href="https://www.google.com">Visit Google</a>In this example, when a user clicks on the text "Visit Google", they will be taken to https://www.google.com.
Challenge
EasyCreate an HTML document that includes the following links:
- A link that points to "https://coddy.tech" and displays the text "Visit Coddy".
- A link that points to "https://www.google.com" and displays the text "Visit Google".
Bonus: try clicking the links!
Cheat sheet
Links in HTML are created using the <a> (anchor) tag with the href attribute:
<a href="url">Link text</a>href: The destination URLLink text: The visible clickable text
Example:
<a href="https://www.google.com">Visit Google</a>Try it yourself
<!DOCTYPE html>
<html>
<body>
<!-- Write code here -->
</body>
</html>This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
2Text and Formatting
HeadingsParagraphsLine BreaksBold and Italic TextBold and Italic AgainRecap - Formatting8Forms and Inputs Part 1
Form BasicsText InputsInput AttributesPassword FieldLabels for InputsRecap - Basic Form11Event Registration Page
Project OverviewHeader Section9Forms and Inputs Part 2
Radio ButtonsCheckboxesDropdownsButtonsButtons in FormsRecap - Forms #1Recap - Forms #2