HTML Links
Links allow users to go from one page to another. In HTML, we use the <a> tag to create links.
1. Basic Link
The <a> tag uses href to specify the link:
<a href="https://aswcode.com">Visit ASWCode</a>
Live Preview:
2. Open Link in New Tab
Use target="_blank" to open the link in a new tab:
<a href="https://aswcode.com" target="_blank">Visit ASWCode in New Tab</a>
Live Preview:
3. Linking Images
You can make an image clickable by putting it inside an <a> tag:
<a href="https://aswcode.com" target="_blank"> <img src="images/nature-forest.png" alt="Nature"> </a>
Live Preview:
4. Internal Link
Link to another page on your own website:
<a href="02-html-tags.html">Go to HTML Tags Lesson</a>
Live Preview:
Next Lesson → HTML Style Attribute
Previous Lesson → HTML Images