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:
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.htmldog.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.alltutotialpoint.blogspot.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="
alltutotialpoint.blogspot.com
">
All Tutorial</a> or something like this.
Note:
A link can also send a user to another part of the same page they are on.
You can add an id attribute to just about any tag, for example
<h2 id="moss">Moss</h2>,
and then link to it by using something like this: <a href="#moss">Go to moss</a>.
Selecting this link will scroll the page straight to the element with that ID.
No comments:
Post a Comment