How to write HTML link code.
<a href="link/html-text-link.htm">Text Link</a>
The code will create this link:
Anchor link code:
<a href="#generator">Link code generator</a>
The code will create this link:
When pressing the link the browser will jump to the heading below, with this code:
<h2><a id="generator">Link code generator</a></h2>
<a href="link/link-image.htm"><img src="link/flower.jpg" width="82" height="86" alt="Flower"></a>
The code will create this link:
<a href="mailto:name@rapidtables.com">Send Mail</a>
The code will create this link:
See: HTML mailto link.
<a href="link/test_file.zip">Download File</a>
The code will create this link:
See: HTML download link
This link will open in new window or tab:
<a href="link/html-text-link.htm" target="_blank">Open page in new window</a>
The code will create this link:
Without javascript:
<form action="link/html-button-link.htm">
<input type="submit" value="A button link">
</form>
With javascript:
<input type="button" value="A button link" onclick="window.location.href='link/html-button-link.htm'">
Changing link color is done with css styling:
<a href="link/html-link-color.htm" style="color:red">Link color page</a>
The code will generate this link:
Changing link background color is done with css styling:
<a href="link/html-link-color.htm" style="background-color:#ffffa0">Link color page</a>
The code will generate this link:
This is a link with relative path URL:
<a href="link/html-text-link.htm">Text Link</a>
The code will generate this link:
This is a link with absolute path URL:
<a href="https://rapid-tables.com/web/html/link/html-text-link.htm">Text Link</a>
The code will generate this link: