HTMLHTML Tutorial
About HTML
HTML Codes/GeneratorsGetting Started HTML Elements HTML Formatting HTML Attributes HTML Colors HTML Links HTML Images HTML Meta Tags HTML Comments HTML Forms HTML Tables HTML Image Maps HTML Frames HTML Entities HTML Layouts HTML Styles HTML Scripts HTML Website Templates Website Hosting Summary HTML Tags HTML 5 Tags Create a Website |
HTML LinksLinks, otherwise known as hyperlinks, are defined using the To create a hyperlink, you use the a tag in conjunction with the href attribute (href stands for Hypertext Reference). The value of the href attribute is the URL, or, location of where the link is pointing to. Example HTML Code:
Visit the <a href="http://www.natural-environment.com/blog/">Natural Environment Blog</a>
This results in:
Visit the Natural Environment Blog
Hypertext references can use absolute URLS, relative URLs, or root relative URLs.
Link TargetsYou can nominate whether to open the URL in a new window or the current window. You do this with the The target attribute can have the following possible values:
Example HTML Code:
Visit the <a href="http://www.natural-environment.com" target="_blank">Natural Environment</a>
This results in:
Visit the Natural Environment
Named AnchorsYou can make your links "jump" to other sections within the same page. You do this with named anchors. To use named anchors, you need to create two pieces of code - one for the hyperlink (this is what the user will click on), and one for the named anchor (this is where they will end up). This page uses a named anchor. I did this by performing the steps below:
This results in: When you click on the above link, this page should jump up to the "Link Targets" section (above). You can either use your back button, or scroll down the page to get back here.You're back? Good, now lets move on to email links. Email LinksYou can create a hyperlink to an email address. To do this, use the Example HTML Code:
<a href="mailto:king_kong@quackit.com">Email King Kong</a>
This results in: Clicking on this link should result in your default email client opening up with the email address already filled out.You can go a step further than this. You can auto-complete the subject line for your users, and even the body of the email. You do this appending Example HTML Code:
<a href="mailto:king_kong@quackit.com?subject=Question&body=Hey there">Email King Kong</a>
This results in: Base hrefYou can specify a default URL for all links on the page to start with. You do this by placing the Example HTML Code:
|
Need Website Content?
Get unique, quality digital content for your website.
|