Links are found in nearly all Web pages. Links allow users to click their way from page to page. To enable site visitors to move around, we need to add navigation. Navigation relies on anchors, which are more commonly referred to as links or urls.
To create a page link you use the element <a> stands for “anchor”. The same as other HTML tags, the anchor element begins with an angle bracket <a and ends with a closing bracket </a>.
The attribute href stands for “hypertext reference”, which specifies where the link leads to – typically an address on the internet or a file name. It's the source of the file used by the tag.
<a href=”filename.html”>Link text here</a>
- The a element contains the link text that will be clicked (which, by default, appears on the screen as blue, underlined text).
- The href (hypertext reference) attribute refers to the URL to which you are linking a page on your website or an external link on the other websites.
- Then you put the name of the link just before the closing tag. If you forget to put the name of the link, you will not see what is the link about
There two different links; the internal links which link your internal web pages and external links which link to other website links.
The internal link
<a href=”webdesign/cheap-website-design.html”>New Web Design</a>
<a href=”about/cheap-web-design.html”>About Desena Web Design</a>
The internal links should open in the same window.
The external link
An external link is a link that points to another website. If you want to include an external link on your website, you must type the whole URL address otherwise it will not work. For example, if I want to include one of the Site Point articles on my website, all I have to do is go to the article page and copy the URL and paste it into the link tag.
<a href="http://www.sitepoint.com/decorating-the-web-with-css-border-images/">Decorating the Web with CSS Border Images</a>
An image link
You can also create a link with an image link. The tag link must come before the image link.
<a href="http://www.desena.com.au/"><img src=”images/desena.jpg” alt=”Desena web design“
width=”200” height=”200” /></a>
Email link - mailto:
Instead of putting the static HTML text for your email, you can create an email link for email. When the link is click, the default email program opens with a new blank message addressed to the specified email address. Please note that this function will only work if there is an email program installed on your computer.
<a href="mailto:firstname.lastname@example.org">email@example.com </a>
The target Attribute - target"_blank
The target attribute specifies where to open the linked document. All external links should be open in a new borwser window.
<a href="http://www.sitepoint.com/decorating-the-web-with-css-border-images/ target="_blank">Decorating the Web with CSS Border Images</a>
The title attribute
The title attribute is used to type a short description of the link.
<a href="http://www.desena.com.au/" target="_blank" title=”Desena Web Design”>Desena Web Design</a>
If you place your cursor over some of my website links, you will see the text.