HTML Link Code
This page contains examples of html link code. You can copy and paste this code into your own HTML documents - just change the values of the attributes as required.
HTML Link: Same Window
||Create a website|
HTML Link: New Window
Check out this website builder.
HTML Link: Email Link
||Send an email to Homer now!|
HTML Link: Named Anchors
Named anchors allow you to "jump" to a given point on a page. This requires two pieces of code: one to create the named anchor, and one to link to the named anchor.
To create a named anchor:
<h2>Link Targets<a name="link_targets"></a></h2>
To link to a named anchor:
<a href="http://www.quackit.com/html/tutorial/html_links.cfm#link_targets" target="_blank">Link Targets</a>
This code results in:
Note that I have previously created the named anchor on the destination page. The link can only work properly if the named anchor has been created on the destination page.
Read more about creating named anchors on the HTML links lesson of the HTML tutorial.
You can also link images. That way, when the user clicks on the image, a new page is displayed (or a larger version of the image). Like this:
To link an image, check out these image link codes.
Link Code Template
You can use the following template as a basis for your HTML link codes. Simply fill in the blanks or remove uneeded attributes.
For an explanation of all the attributes, see the anchor tag.
<a href="" name="" hreflang="" type="" rel="" rev="" charset="" shape="" coords="" target="" accesskey="" dir="" class="" id="" lang="" tabindex="" title="" style="" onfocus="" onblur="" onclick="" ondbclick="" onmousedown="" onmouseup="" onmouseover="" onmousemove="" onmouseout="" onkeypress="" onkeydown="" onkeyup="">Link Text goes here</a>
For various HTML link code usage, check out the HTML links page of the HTML tutorial.
Enjoy this page?
- Link to this page (copy/paste into your own website or blog):
- Link to Quackit using one of these banner ads.
Thanks for supporting Quackit!