Book Image

Practical Web Development

By : Paul Wellens
Book Image

Practical Web Development

By: Paul Wellens

Overview of this book

Table of Contents (23 chapters)
Practical Web Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
10
XML and JSON
Index

Links


In all likelihood, the first web page that was ever created contained a link to the second ever web page. To place a link on a page, we use the anchor tag <a>.

The <a> tag and attributes

If we simply place some text inside an <a> tag, nothing will really happen when you click on it, unless you program the event in JavaScript. However, you can tell from the way it looks on the screen that the intent is for it to be a link. By default, the content of an <a> tag is rendered in the (by now probably notorious) underlined and blue style.

<a>Click here</a>

The href attribute

To make the link work, you need to use the href or hypertext reference attribute. You can link to another web page, external or local, a document or image, or another section of the current page. Here are some examples:

<a href="http://www.packtpub.com">Visit our website</a>
<a href="index.html">Home</a>
<a href="pdfs/manual.pdf">Click here to download the manual...