Friday, June 21, 2013

USING LINKS IN AN HTML SCRIPT

USING LINKS - IN AN HTML SCRIPT


Having links on a web page is probably the most outstanding feature of a web page. Wouldn't it be great if you too have links on your webpage pointing to different web pages.Yeah!! Sounds great,but is it easy? Yes it is.Before i teach you to link other web pages to your web page,let us have a quick flashback of what we have learnt so far-

1.CREATING A SIMPLE WEB PAGE
2.GIVING BACKGROUND COLOR TO YOUR WEBPAGE
3.FORMATTING THE ELEMENTS OF A WEB PAGE

You can see the three links above also.Just click on them and they will take you where you want.What if your web page has a link to Google search engine and any one can go to the Google search engine by clicking the web link on your webpage.Sounds cool right?

So let us see the script to do so:

<html>
  <head>

  <title>I LOVE BLOGGING</title>

</head>
    <body style="background-color: #ff0000";>
      
     <h1 style="background-color: #00FF00">ALL ABOUT BLOGGING</h1>
     <h2 style="background-color: #00ffcc">MY BLOG</h2>
     <p style="background-color: #00ff99">blogging is great!!!!!</p>
     <a href="http://www.google.com/">This is a link to Google search engine</a> 
    
    <body/>
  
</html>


And this would be the expected output:

how do i use links in my webpage



Please note that you can use notepad or any similar text editor to write the code and then test the code by opening it in any browser.

You can see the underlined link in your web page.Just take your mouse pointer over the link and it converts into hand showing that it is a link.Click on the link and you will be redirected to Google's search page.Whoa!!!!!!!!!!!!! It worked!!! Are you happy now?

Look at the code carefully:

 <a href="http://www.google.com/">This is a link to Google search engine</a>

Here,  
a - means anchor, and 
href - means hypertext reference.

One more practice for good understanding - Please save all the web pages that you make in a single folder.If you have them in a single folder you can link one page to another web page.For example i have two web pages in my folder namely: wepage1.htm and webpage2.htm,then i can link to webpage2 from my webpage1 by using the line:

 <a href="webpage2.html">This is a link to webpage 2</a>

And if your webpage is in a sub folder then the line will be:

 <a href="subfolder/webpage2.html">This is a link to webpage 2</a>

If you have all the files in a single folder it will be easier for you to link them.Later we would see that we can link other web pages,images(in your folder or from other websites),and many other types of files.I hope this would increase your interest in learning HTML.

Please try to link to various web pages and have fun.If you have any query feel free to comment and i will get back to you as soon as possible.Till then Keep up the good work.Take care.














No comments:

Post a Comment

Thanks for your valuable comment