HTML `a` tag

Explore the basics of using HTMLaMark to create link

The link is to usealabel. The link target is set through its settinghrefAttributes.

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/testThe URL of the current source.

Be careful/Features. If omitted, the browser will addtestThe string of the current URL.

For example, I’m on the pagehttps://flaviocopes.com/axios/I have these links:

  • /testOnce clicked, it takes me tohttps://flaviocopes.com/test
  • testOnce 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 usetargetAttributes:

<a href="https://flaviocopes.com" target="_blank">open in new tab</a>

Download mine for freeHTML manual


More HTML tutorials: