Saturday, December 13, 2014

Learn HTML for beginner : Links

An anchor tag (a) is used to define a link, but you also need to add something to the anchor tag - the destination of the link.
Add this to your document:

<!DOCTYPE html>

<html>

<head>
<title>My first web page</title>
</head>

<body>

<h1>My first web page</h1>

<h2>What this is</h2>
<p>A simple page put together using HTML</p>

<h2>Why this is</h2>
<p>To learn HTML</p>

<h2>Where to find the tutorial</h2>
<p><a href="http://www.netomoney.com">HTML Dog</a></p>

</body>

</html>
The destination of the link is defined in the href attribute of the tag. The link can be absolute, such as “http://www.htmldog.com”, or it can be relative to the current page.
So if, for example, you had another file called “flyingmoss.html” in the same directory then the line of code would simply be <a href="flyingmoss.html">The miracle of moss in flight</a> or something like this.
A link does not have to link to another HTML file, it can link to any file anywhere on the web.





No comments:

Post a Comment