Hyper Text Markup Language
Hyper Text Markup Language
Hyper Text Markup Language
Paragraphs
Paragraphs are defined with the <p> tag.
<p>This is a paragraph</p>
<p>This is another paragraph</p>
HTML automatically adds an extra blank line before and after a paragraph.
Line Breaks
The <br> tag is used when you want to end a line, but don't want to start a new
paragraph. The <br> tag forces a line break wherever you place it.
<p>This <br> is a para<br>graph with line breaks</p>
The <br> tag is an empty tag. It has no closing tag.
Comments in HTML
The comment tag is used to insert a comment in the HTML source code. A comment
will be ignored by the browser. You can use comments to explain your code, which can
help you when you edit the source code at a later date
<!-- This is a comment -->
Note that you need an exclamation point after the opening bracket, but not before the
closing bracket.
Character Entities
Some characters have a special meaning in HTML, like the less than sign (<) that
defines the start of an HTML tag. If we want the browser to actually display these
characters we must insert character entities in the HTML source.
A character entity has three parts: an ampersand (&), an entity name or a # and an
entity number, and finally a semicolon (;).
To display a less than sign in an HTML document we must write: < or <
The advantage of using a name instead of a number is that a name is easier to
remember. The disadvantage is that not all browsers support the newest entity names,
while the support for entity numbers is very good in almost all browsers.
Note that the entities are case sensitive.
Non-breaking Space
The most common character entity in HTML is the non-breaking space.
Normally HTML will truncate spaces in your text. If you write 10 spaces in your text
HTML will remove 9 of them. To add spaces to your text, use the character
entity.
The Most Common Character Entities:
<HTML>
<HEAD>
<TITLE>Subscript and Superscript</TITLE>
</HEAD>
<BODY>
E=mc<sup>2</sup>
<p>
H<sub>2</sub>O.
</BODY>
</HTML>
Linking HTML Pages
The World Wide Web would not be a Web if not for the existence of hypertext links. Hypertext links enable you
to link one HTML document to another. They allow you to move from one Web page to another with a single
mouse click.
The second part of the URL provides the domain name of the resource you are attempting to access.For e.g.,
Yahoo is registered on the Internet with the domain name www.yahoo.com you can transfer the home page of
this website to your computer by typing http://www.yahoo.com into the address bar of your browser.
However, the Yahoo website has more than one webpage. I you need to access a particular web page on the
Yahoo site other than the home page, you need to provide additional information. In the third part of the URL,
you specify the location of particular HTML file that you are interested in retrieving.For e.g.
http://www.itoncorp.com/main.html
Linking Between Web Sites
To link your Web page to other page on the World Wide Web, you use something called
a hypertext anchor. To create a hypertext anchor, you use the <A> HTML tag.
<HTML>
<HEAD>
<TITLE>Inter-Site Anchor</TITLE>
</HEAD>
<BODY>
<A HREF=http://www.itoncorp.com>ITON</A>
</BODY>
</HTML>
The <A> tag is a container tag. The text that it contains becomes a hypertext link. In the
above e.g. the text ITON is displayed in a browser with an underline.This tells the viewer
of the page that the text is a hypertext link. You supply the Web address as the value of
the HREF attribute of the <A> tag. This address can be the URL of any page on any web
site in the world.
Linking within a Web Site
Your website probably will have more than one page, and you will want the users of
your website to able to move easily from one page to another. To allow this, you need
to add hypertext anchors that link your website’s pages together. You create links
within your web site in the same way that you create links between web sites.
<A href=“that.htm”>That</a>
<A href=“this.htm”>This</a>
Linking Within a Web Page
Some times its useful to have hypertext links that take you to a particular location within a page. For e.g., if you
have a table of contents at the top of a web page, you may want the users of your Web page to be able to click
different parts of the table of contents to arrive at particular sections of your document. You can use the <A> tag
to create this type of hypertext link as well.
<HTML>
<HEAD>
<TITLE> Linking within a web Page </TITLE>
</HEAD>
<BODY>
<H1> Contents </H1>
<A HREF=“#section1”> Section I </A>
<BR>
<A HREF=“#section2”>Section II </A>
<P>
<A NAME=“section1”>Section I </A>
<BR>
This is the first section.
<P>
<A NAME=“section2”>Section II</A>
<BR>
This is the second section.
<A HREF=“that.htm”>That</A>
</BODY>
</HTML>
Linking to a named location within another document.
You can also use the <A> tag to create a hypertext link to a named location within another document.
For example, suppose you have created a location in the HTML file “that.htm” with the name “there_in_that”.
You can create a hypertext link to this named location by using the following tag in the this.htm file
<A HREF=“that.htm#there_in_that”> Go There </A>
Controlling the Color of Links
Prior to the first time a hypertext link is clicked the text appears in a bright blue color.
After the links is clicked and the destination has been visited, the color of the hypertext
link changes to purple. Finally, while the mouse button actually is being held down on
the hypertext link, the text appears red.
The three attributes that control the color of a hypertext link are the LINK, VLINK, and
ALINK attributes. All three of these are attributes of the <BODY> tag.
e.g. <BODY LINK=“lime” VLINK=“lime” ALINK=“lime”>
<A HREF=http://www.itoncorp.com>ITON</a>
</BODY>
</HTML>
LINK attribute determines the color of links that have yet to be visited.
VLINK attribute determines the color of visited links.
ALINK attribute determines the color of links that are actively being clicked.
Adding images to your Web Page
Adding images to your web page is easy. To add an image, use the <IMG> HTML tag.
<HTML>
<HEAD><TITLE>Image e.g.</TITLE></HEAD>
<BODY>
<IMG SRC=“iton.gif” width=10 height=12 ALT=“Iton Logo”>
</BODY>
</HTML>
Align = Top, middle, bottom, left, right
Creating Links with Images
<HTML>
<HEAD>
<TITLE>Image attributes</TITLE>
</HEAD>
<BODY>
<A HREF=http://www.itoncorp.com><img SRC=“itoncorp.gif”></A>