0% found this document useful (0 votes)
86 views5 pages

Hyperlink

The document discusses hyperlinks and the anchor tag. It defines a hyperlink as a direct reference within a hypertext document. The anchor tag creates hyperlinks using the href attribute and targets using attributes like target. It provides examples of how to create internal and external hyperlinks and anchors on a page using the anchor tag.

Uploaded by

Lira Velasco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views5 pages

Hyperlink

The document discusses hyperlinks and the anchor tag. It defines a hyperlink as a direct reference within a hypertext document. The anchor tag creates hyperlinks using the href attribute and targets using attributes like target. It provides examples of how to create internal and external hyperlinks and anchors on a page using the anchor tag.

Uploaded by

Lira Velasco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

WEB DEVELOPMENT AND

INTERNET TECHNOLOGIES 1

LESSON 8: HYPERLINK
Objectives:
At the end of the lesson students are able to:
1. Identify what is hyperlink.
2. Analyze how to use the anchor tag
3. Create a simple program using anchor tag

Hyperlinks
• Hyperlink, usually shortened to link, is a direct reference within a hypertext document.

• The area from which the hyperlink can be activated is called anchor.

Anchor Tag

• With the attribute href (hypertext reference), the anchor becomes a hyperlink to either another
part of the document or another resource (e.g. a webpage) using an external Uniform Resource
Locator (URL).

• An anchor tag basically has the following syntax:

• The attribute title may be set to give brief information about the link:


Alternatively (and sometimes concurrently), with the name or id attributes set, the element
becomes a target. A URL can link to this target via a fragment identifier. Any element can now
be made into an anchor by using the id attribute, so using <a name="food"> is not necessary.

Where:

• href – defines the link "address".

• target – defines where the linked document will be opened.


WEB DEVELOPMENT AND
INTERNET TECHNOLOGIES 2

Values:

• blank – to open the target URL on a new window

• _self – to open the target URL in the same frame as it was clicked

• _parent – to open the target URL in the parent frameset.

• _ top – to open the target URL in the full body of the window

• name – defines an internal bookmark of the page. This is for linking to a specific part of the page

To create a hyperlink to www.google.com by using the same browser window:

To create an internal named anchor on the HTML document:

In most graphical browsers, when the cursor hovers over a link, it typically changes into a hand with a
stretched index finger ( ), and the title appears in some way (varies according to browser). Some
browsers render alt text the same way, though this is technically incorrect.
WEB DEVELOPMENT AND
INTERNET TECHNOLOGIES 3

Links and Anchor Attributes


• a hyperlink is a reference (an address) to a resource on the web. Hyperlinks can point to any
resource on the web: an HTML page, an image, a sound file, a movie, etc. An anchor is a term
used to define a hyperlink destination inside a document.

• The HTML anchor element <a> is used to define both hyperlinks and anchors.

• The term HTML link is used when the <a> element points to a resource and the term HTML
anchor when the <a> elements define an address inside a document.

• Link syntax:

• The start tag contains attributes about the link. The element content (Link text) defines the part
to be displayed.

• Note: The element content does not have to be a text. You can link from an image or any other
HTML element.

The href Attribute

• The href attribute defines the link "address". This <a> element defines a link to W3Schools web
page:

• The target Attribute

• The target attribute defines where the linked document will be opened. The code below will
open the document in a new browser window.
WEB DEVELOPMENT AND
INTERNET TECHNOLOGIES 4

• The name Attribute

• When the name attribute is used, the <a> element defines a named anchor inside a HTML
document. Named anchor are not displayed in any special way. They are invisible to the reader.
WEB DEVELOPMENT AND
INTERNET TECHNOLOGIES 5

URL Encoding
• URL encoding converts characters into a format that can be safely transmitted over the
Internet. URL means Universal Resource Locator.
• Web browsers request pages from web servers by using a URL. The URL is the address of
a web page i.e. http://www.ilearntechnologies.com.
• URLs can only be sent over the Internet using the ASCII character-set. Since URLs often
contains characters outside the ASCII set, the URL has to be converted. URL encoding
converts the URL into a valid ASCII format.

You might also like