Links
This page demonstrates how to create a basic hyperlink. Also known simply as "links", hyperlinks are one of the most common elements on the web.
Although most web developers use HTML to create their links, some use JavaScript. JavaScript is a programming/scripting language that allows you to have more control over the web pages you create. Actually, many websites use a combination of HTML, JavaScript, and other scripting/database languages.
But, let's not get too carried away. For a basic, static link to another web page, using HTML is the best way to do it.
Create a Basic HTML Link
HTML links are created using the HTML <a>
tag. The <a>
tag stands for "anchor" tag. To create a link, you need to fill out the href
attribute with the destination URL (i.e. the address of the web page that you want the link to point to). You also need to specify the text you'd like to be hyperlinked, and close the tag.
Example:
Source Code | Result |
---|---|
As you can see, the above link goes to http://www.zappyhost.com
(this is specified with the href
attribute). The "anchor text" is "Zappyhost - Web hosting". This is the text that will be linked.
Inline Links
You can place links anywhere within a block of text. Like this:
Source Code | Result |
---|---|
The quickest way to create a website is with a Zappyhost and their website builder. Includes free hosting, images, templates, and more! |
More HTML Link Code
The above examples represent the most common usage of HTML links. There are many variations on creating links for your website. Check out the various link code below: