Links are what make the web the web. With a simple mouse click they let you transfer to another page anywhere on the World Wide Web.
The format of a link looks like this:
<a href="index.html">Go Home</a>
Let's look at each part of this statement:
href stands for
index.html is the value of the
attribute. The browser will load this page when the hyperlink element
Attributes, as you may recall from the section with that title in
Lesson 1, are modifiers of html
elements with values assigned to names using
name="value" inside the open tag of an element.
href attribute is required for hyperlink elements.
The attribute in the hyperlink tag,
href, stands for
reference. It is the
href attribute that tells the browser
which location to load when the
hyperlink (or as it's
more commonly called, link) element is clicked. Links are what
World Wide Web
and makes it so popular.
The value of an href attribute is usually a web address, which describes the location of another web page. Web addresses are also called URLs. There are two ways to specify the location of a hypertext link.
absolute location uses the entire URL, like:
Not only is this tedious to type, but using absolute locations makes it difficult to move your site, which brings us to...
Let's say you want to go from
From inside the
lesson6.html file, the link only needs to
be written as:
<a href="lesson7.html">Lesson 7</a>
lesson7.html are in the same
directory, and so have the same relative location.
Hyperlinks can also link to places within a document - either the same document or a different one. For example, clicking this link will take you the format section at the beginning of this lesson.
Two attributes were combined to make that work. First, an
id="format" attribute was added to the
h2 element at the beginning of the lesson. Second, a link
href="#format" was put around the the word
this, making it a local link.
The link to the Attributes section of Lesson 1 above is another example of a link to a location within a document. In this case the link looks like this:
<a href="lesson1.html#attributes">Lesson 1</a>
and is combined with the element
in Lesson 1 to make the link.
My Favorite Web Sitesin the title and a top level heading. Create an ordered list with absolute links to your top 10 favorite websites. Your completed
favorite.html might should look
gdw.html file that you created in Lesson 2,
making the following changes:
Object Elements, and
Characters from third level headings to list items. Put them
in an unordered list. Make
Block-level Elements link to
block.html that you created in lesson 3.
Inline Elements should link to
Object Elements to
Special Characters to
Description from third level headings to list items.
Put them in an unordered list. Link
Ordered to the file
ordered.html that you created in lesson 4. Link the
other two labels to their corresponding files as well.
heading with two items:
Decimal, Binary, Octal, and Hex,
My Table. Link the first one to the
decbinocthex.html file you made in lesson 5, and the
second one to
Relative) and in their place
create an unordered list with a single list item. Put the text
My Favorite Websites in this list item and link it to
favorite.html file you created in the previous
Gallery I and
Gallery II as
the text in these list items. You will make these links in the next
gdw.html page should look something
like this, and
all the links should load the correct pages when clicked.