What is a hyperlink?
A link to some web page. If we click on the hyperlink, then the page associated with this hyperlink is open.
How to put the hyperlinks in HTML?
There are two methods;
- Relative path
- Absolute path
Relative path: need to put both files in one folder, so there is no need to put the full path indicating that there is a file located. For example <a href=”b.html”>Click here</a>
Relative Path Example:
Step 1: Store all the web pages in the same folder
Step 2: Write the code for the first page
Step 5: Check the output
Step 6: Open the page 1 and click on the link below
Step 7: New page appears
Can I put the image in a separate folder and code file in the separate folder?
Yes, you can but you need to put the absolute path.
What is the absolute path?
An absolute path is a full path indicating that where is the file located.
- your image name is 1
- Your image type is jpg
- Your image is in folder (images)
Then we can put the code as follows: <img src=”images/1.jpg” />
More examples of absolute path
- <a href=”folder1/b.html”>Click here</a>
- <a href=”folder1/folder2/b.html”>Click here</a>
- <a href=”../b.html”>Click here</a>
- <a href=”../../b.html”>Click here</a>