0% found this document useful (0 votes)
64 views4 pages

4) Linking: URL - Uniform Resource Locator

The <a> tag is used to define hyperlinks in HTML. It can be used to link to other documents by specifying the href attribute with a URL, or to create bookmarks within a document using the name attribute. Common attributes for the <a> tag include href to specify the link destination, and target to set where linked documents should open (e.g. in a new window). By default, unvisited links are underlined and blue, visited links are underlined and purple, and active links are underlined and red. The mailto link can be used to create links that launch a user's default email client and populate the address field.

Uploaded by

kalpana_mandhane
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views4 pages

4) Linking: URL - Uniform Resource Locator

The <a> tag is used to define hyperlinks in HTML. It can be used to link to other documents by specifying the href attribute with a URL, or to create bookmarks within a document using the name attribute. Common attributes for the <a> tag include href to specify the link destination, and target to set where linked documents should open (e.g. in a new window). By default, unvisited links are underlined and blue, visited links are underlined and purple, and active links are underlined and red. The mailto link can be used to create links that launch a user's default email client and populate the address field.

Uploaded by

kalpana_mandhane
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

4) Linking

URL - Uniform Resource Locator


When you click on a link in an HTML page, an underlying <a> tag points to an address on the world wide
web.A Uniform Resource Locator (URL) is used to address a document (or other data) on the world wide
web.A web address, like this: http://www.w3schools.com/html/default.asp follows these syntax rules:

scheme://host.domain:port/path/filename

Explanation:

 scheme - defines the type of Internet service. The most common type is http
 host - defines the domain host (the default host for http is www)
 domain - defines the Internet domain name, like w3schools.com
 :port - defines the port number at the host (the default port number for http is 80) 
 path - defines a path at the server (If omitted, the document must be stored at the root directory
of the web site
 filename - defines the name of a document/resource

HTML Hyperlinks (Links)


A hyperlink (or link) is a word, group of words, or image that you can click on to jump to a new document or
a new section within the current document.When you move the cursor over a link in a Web page, the arrow
will turn into a little hand.

Links are specified in HTML using the <a> tag.

The <a> tag can be used in two ways:

1. To create a link to another document, by using the href attribute


2. To create a bookmark inside a document, by using the name attribute

HTML Link Syntax


Link Tags
Tag Description
<a> Defines an anchor

The HTML code for a link is simple. It looks like this:

<a href="url">Link text</a>

The href attribute specifies the destination of a link.

Example
<a href="http://www.w3schools.com/">Visit W3Schools</a>
which will display like this: Visit W3Schools

Links Attribute
The target Attribute
The target attribute specifies where to open the linked document.

The example below will open the linked document in a new browser window:

<a href="http://www.w3schools.com/" target="_blank">Visit W3Schools!</a>

The name Attribute


The name attribute specifies the name of an anchor.
The name attribute is used to create a bookmark inside an HTML document.Bookmarks are not displayed in
any special way. They are invisible to the reader.

Example
A named anchor inside an HTML document:

<a name="tips">Useful Tips Section</a>

Create a link to the "Useful Tips Section" inside the same document:

<a href="#tips">Visit the Useful Tips Section</a>


<a href="http://www.w3schools.com/html_links.htm#tips">
Visit the Useful Tips Section</a>

<a> (Anchore)Tag
Example
A link to W3Schools.com:

<a href="http://www.w3schools.com">Visit W3Schools.com!</a>

Definition
The <a> tag defines an anchor. An anchor can be used in two ways:

1. To create a link to another document, by using the href attribute


2. To create a bookmark inside a document, by using the name attribute

The <a> element is usually referred to as a link or a hyperlink.The most important attribute of the <a>
element is the href attribute, which indicates the link’s destination.

By default, links will appear as follows in all browsers:

 An unvisited link is underlined and blue


 A visited link is underlined and purple
 An active link is underlined and red

Optional Attributes
Attribute Value Description DTD

charset char_encoding Specifies the character-set of a linked document STF

coords coordinates Specifies the coordinates of a link STF

href URL Specifies the destination of a link STF

hreflang language_code Specifies the language of a linked document STF

name section_name Specifies the name of an anchor STF

rel text Specifies the relationship between the current document STF
and the linked document

rev text Specifies the relationship between the linked document STF
and the current document

target _blank Specifies where to open the linked document TF


_parent
_self_top
framename

Mailto anchor
The mail to is used to send electronic mail. If browser support mailto URL & make a
link to some text to mail with anchor by using mailto send message to the appropriate adderss.
Syntax: mailto:e-mail adderss

Example:<a href="mailto:[email protected]>

<html>
<body>
<p>
This is an email link:
<a href="mailto:[email protected]?Subject=Hello%20again">
Send Mail</a>
</p>
<p>
<b>Note:</b> Spaces between words should be replaced by %20 to ensure that the browser will display
the text properly.
</p>
</body>
</html>

Output: This is an email link: Send Mail

Note: Spaces between words should be replaced by %20 to ensure that the browser will display the text
properly.

You might also like