ASWCode Tutorials

Learn Web Development - From Basics to Advanced

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:

Visit ASWCode

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:

Visit ASWCode in New Tab

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:

Nature

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:

Go to HTML Tags Lesson

Next Lesson → HTML Style Attribute

Previous Lesson → HTML Images

← Back