You are on page 1of 14

Basic HTML-Lecture 3

Links, Anchor tags and iframes


Source codes available for reference

<a> anchor tag


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

To create a link to another document, by using the href attribute 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 links 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

Links
<a href= ht.html>click to see me</a>

Absolute path
Absolute paths are called that because they refer to the very specific location, including the domain name. The absolute path to a Web element is also often referred to as the URL. For example, the absolute path to this Web page is: http://webdesign.about.com/library/weekly/a a040502a.htm

Relative path
Relative Path URLs Relative paths change depending upon what page the links are located on. There are several rules to creating a link using the relative path: links in the same directory as the page have no path information listed filename sub-directories are listed without any preceding slashes weekly/filename links up one directory are listed as ../filename

Iframes
An inline frame is marked up as follows:

<iframe src="http://www.w3schools.com"></iframe>

Some attributes

Links in same document.


<p> <a href="#C4">See also Chapter 4</a> </p> <h2><a name="C4">Chapter 4</a></h2> <p>This chapter explains ba bla bla</p>

images
<img src=></img> Always store all your images in an image named for good practice folder.

Superscript and subscript

Superscript and subscript-Result

Opening a new link window


<a href="http://www.pageresource.com/linkus.h tm" target="_blank"> Link to us!</a>

Images as links
<a href=><img src=></img></a> Demonstration

Coming next.
Frames Part 1. Frames Part 2. Frames Part 3.

You might also like