Hyperlink

Hyperlinks

For liking html document together, the anchor element is used for it. HREF attribute are used inside the Anchor element. The value of the attribute HREF is the path to the location of the target document (either a complete URL or a relative path - explained below) the content of the element is what appears as link text (or image).

For example we want to create a link to Google.com in my website the value of HREF in this case is the complete URL of Google.com

http://www.google.com

The code will be:

< a href=”http://www.easywebtutorials.com”> Visit www.google.com < /a >



Link Own Pages Together

There are two way to like you own pages together absolute URL or relative URL

  • absoluteURL:< a href="http://www.yourdomain.com/contact.html">
  • relative URL: < a href="contact.html" >:


1. if you want to link from your homepage (index.html) to your contact page (contact.html), the below code is used for it.

The code will be:

< a href=”contact.html” > Contact < /a >



2. If you want to link from your homepage to a webpage located in a subfolder

The code will be:

< a href=”subfolder/contact.html” > Contact < /a >


3. For like back from contact to the homepage, the below code is used for it. We will use two full stops instead of writing only index.html.

The code will be

< a href=”../index.html” > Home < /a >



4. If you want that you link open in new window, use the below code for it

The code will be:

< a href= “http://www.google.com” target=”_blank” > Visit Google.com < /a >

 
 
Today, there have been 54 visitors (112 hits) on this page!
This website was created for free with Own-Free-Website.com. Would you also like to have your own website?
Sign up for free