Explore the basics of using HTMLa
Mark to create link
The link is to usea
label. The link target is set through its settinghref
Attributes.
example:
<a href="https://flaviocopes.com">click here</a>
Between the start tag and the end tag, we have the link text.
The example above is an absolute URL. Links can also use relative URLs:
<a href="/test">click here</a>
In this case, after clicking the link, the user will move to/test
The URL of the current source.
Be careful/
Features. If omitted, the browser will addtest
The string of the current URL.
For example, I’m on the pagehttps://flaviocopes.com/axios/
I have these links:
/test
Once clicked, it takes me tohttps://flaviocopes.com/test
test
Once clicked, it takes me tohttps://flaviocopes.com/axios/test
Link tags can contain other content, not just text. For example, the image:
<a href="https://flaviocopes.com">
<img src="test.jpg">
</a>
Or any other element, in addition to other<a>
label.
If you want to open the link in a new tab, you can usetarget
Attributes:
<a href="https://flaviocopes.com" target="_blank">open in new tab</a>
Download mine for freeHTML manual
More HTML tutorials:
- Introduction to HTML
- HTML `iframe` tag
- HTML table
- HTML `video` tag
- HTML `audio` tag
- HTML tags for text
- HTML table
- HTML `img` tag
- HTML `a` tag
- HTML `picture` tag
- HTML `figure` tag
- HTML container tags
- Accessibility on the web
- How to create comments in HTML
- How to change HTML image URL in dark mode
- Responsive image using `srcset`
- Change icon in dark mode