Ob b59f54 Introduction-To-Html PDF
Ob b59f54 Introduction-To-Html PDF
Progressive
*
Comprehensive High School Peace – Work – Fatherland
PCHS Mankon – Bamenda SCHOOL YEAR 2013/2014
Department of Computer Studies
INTRODUCTION TO HTML
Subject: Comp. Sc Level: A/L By: DZEUGANG PLACIDE
Welcome to HTML Basics. This lesson leads you through the basics of Hyper Text Markup
Language (HTML). HTML is the building block for web pages. You will learn to use HTML to
author an HTML page to display in a web browser.
Objectives
By the end of this topic, you will be able to:
Table of Contents
Objectives..................................................................................................................................................... 1
I. INTRODUCTION............................................................................................................................... 2
II. CREATING, SAVING AND VIEWING A HTML DOCUMENT............................................. 2
III. FORMATTING A WEB PAGE .................................................................................................... 5
IV. CHARACTER FORMATTING TAGS ........................................................................................ 8
V. HTML LIST ...................................................................................................................................... 11
VI. HTML IMAGE ............................................................................................................................. 12
VII. HTML LINK ................................................................................................................................. 15
VIII. HTML TABLE .......................................................................................................................... 17
I. INTRODUCTION
HTML (Hypertext Markup Language) is used to create document on the World Wide Web. It is
simply a collection of certain keywords called „Tags‟ that are helpful in writing the document to
be displayed using a browser on Internet.
It is a platform independent language that can be used on any platform such as Windows, Linux,
Macintosh, and so on. To display a document in web it is essential to mark-up the different
elements (headings, paragraphs, tables, and so on) of the document with the HTML tags. To
view a mark-up document, user has to open the document in a browser. A browser understands
and interpret the HTML tags, identifies the structure of the document (which part are which) and
makes decision about presentation (how the parts look) of the document.
HTML also provides tags to make the document look attractive using graphics, font size and
colors. User can make a link to the other document or the different section of the same document
by creating Hypertext Links also known as Hyperlinks.
- Container Tags which have both the opening and closing i.e. <TAG> and </TAG>.
They hold the text and other HTML tags in between the tags. The <HTML>, <HEAD>,
<TITLE> and <BODY> tags are all container tags.
- Empty Tags, which have only opening and no ending, The <HR>, which is used to draw
Horizontal, rule across the width of the document, and line break <BR> tags are empty
tags.
HTML tags are not case sensitive. <B>means the same as <b>. But the World Wide Web
Consortium (W3C), the group responsible for developing web standards, recommends lowercase
tags
→ <html>.............</html>
→ <head>.............</head>
→ <body>.............</body>
Any HTML document then has the following structure
<HTML>
<HEAD>
.............
.............
.............
</HEAD>
<BODY>
.............
.............
All visible
.............
content
</BODY>
goes here
</HTML>
Tag Description
<html> Defines an HTML document
<body> Defines the document's body
<h1> to <h6> Defines header 1 to header 6
<p> Defines a paragraph
<br> Inserts a single line break
<hr> Defines a horizontal rule
<!--> Defines a comment
a) Heading <H1>.............<H6>
HTML has six header tags <H1>, <H2>...........<H6> used to specify section headings. Text with
header tags is displayed in larger and bolder fonts than the normal body text by a web browser.
Every header leaves a blank line above and below it when displayed in browser. For example,
the following code
<HTML>
<HEAD>
<TITLE>
Section Heading
</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
Would display
This code
<h5 align="left">I can align headings </h5>
<h5 align="center">This is a centered heading </h5>
<h5 align="right">This is a heading aligned to the right </h5>
Would display
b) Paragraphs:
This tag <P> indicates a paragraph, used to separate two paragraphs with a blank line. Think of a
paragraph as a block of text. You can use the align attribute with a paragraph tag as well.
This code
<p align="left">This is a paragraph</p>
<p align="center">this is another paragraph</p>
Would display
This is a paragraph
this is another paragraph
c) Line Breaks
The empty tag <BR> is used, where the text needs to start from a new line and not continue on
the same line. To get every sentence on a new line, it is necessary to use a line break.
This Code Would Display
<p>This <br> is a para<br> graph with This
line breaks</p> is a para
graph with line breaks
d) Horizontal Rule
The <hr>element is used for horizontal rules that act as dividers between sections, like this:
The horizontal rule does not have a closing tag. It takes attributes such as align and width.
<HR> accepts following attributes:
SIZE: Determines the thickness of the horizontal rule. The value is given as a pixel
value.
WIDTH: Specifies an exact width of HR in pixels, or a relative width as percentage of
the document width.
ALIGN: Set the alignment of the rule to LEFT, RIGHT and CENTER. It is applicable if
it is not equal to width of the page.
NOSHADE: If a solid bar is required, this attribute is used; it specifies that the horizontal
rule should not be shaded at all.
COLOR: Set the color of the Horizontal rule.
Example
This Code Would Display
<hr align="center" width="50%"
size="3" noshade color="blue">
e) Comments <!--……..-->
The comment tag is used to insert a comment in the HTML source code. A comment can be
placed anywhere in the document and the browser will ignore everything inside the brackets.
You can use comments to write notes to yourself, or write a helpful message to someone looking
at your source code.
Notice you don't see the text between the tags <!--and -->. If you look at the source code, you
would see the comment. To view the source code for this page, in your browser window, select
View and then select Source.
Note: You need an exclamation point after the opening bracket <!--but not before the closing bracket -->.
<PRE> tag can be used, where it requires total control over spacing and line breaks such as
typing a poem. Browser preserves your space and line break in the text written inside the tag.
Example:
The character formatting tags are used to specify how a particular text should be displayed on the
screen to distinguish certain characters within the document.
The most common character formatting tags are:
Font Colours and Size <font> …..</font> specify the colors and/or size of the text.
• color: Sets the color of the text that will appear on the screen.
• size: Sets the size of the text, takes value between 1 and 7, default is 3. Size can also be
set relative to default size. For example; size=+X, where X is any integer value and it
will add with the default size.
• face: Sets the normal font type, provided it is installed on the user‟s machine.
Example:<FONT FACE="ARIAL"> the text will be displayed in Arial</FONT>
Colors are defined using a hexadecimal notation for the combination of red, green, and blue
color values (RGB). The lowest value that can be given to one light source is 0 (hex #00). The
highest value is 255 (hex #FF). This table shows the result of combining red, green, and blue: A
collection of color names is also supported by most browsers.
HTML Backgrounds
The <body>tag has two attributes where you can specify backgrounds. The background can be a
color or an image.
Bgcolor: The bgcolor attribute specifies a background-color for an HTML page. The
value of this attribute can be a hexadecimal number, an RGB value, or a color name:
<body bgcolor="#000000">
<body bgcolor="rgb(0,0,0)">
<body bgcolor="black">
The lines above all set the background-color to black.
<body background="clouds.gif">
<body background="http://profdevtrain.austincc.edu/html/graphics/clouds.gif">
The URL can be relative (as in the first line above) or absolute (as in the second
line above).
Special character
There are certain special characters that can be used while creating document.
Following are some special character
Symbols Entity
©, ® ©, ®
¼, ½, ¾ ¼, ½, ¾
†; ˂; ˃; ≤; ≥ ÷, <, >, &le, &ge
& &
♣♠♥ &spades, &clubs, &hearts All these special character must
V. HTML LIST
HTML Supports several ways of arranging items in lists. The most commonly used are:
Ordered list also called as Numbered list, is used to present a numbered list of item in the order
of importance or the item (paragraph) is marked with a number.
An ordered list starts with the <ol>tag. Each list item starts with the <li> tag.
Attribute Description
Type = A Capital letter eg. A, B, C………
Start: used for lists that need to start at values other than 1. start always specified in
default numbers, and is completed based on TYPE before display, For example, If
start =5 it would display either an „E‟, „e‟, „V‟, „v‟, or „5‟ based an TYPE attribute.
An unordered list is a list of items marked with bullets (typically small black circles). An
unordered list starts with the <ul>tag. Each list item starts with the <li>tag.
It is an empty tag(only start tag, no end tag) and is written as: <IMG SRC = image_URL>
SRC is the Source of the image file and image_URL represents the image file with its location.
Not only does the source attribute specify what image to use, but where the image is located. The
above image, graphics/chef.gif, means that the browser will look for the image name chef.gif in
a graphics folder in the same folder as the html document itself.
src="../../../other/images/chef.gif" means
this goes multiple layers up.
This SRC attribute is mandatory for the <IMG> tag. Other attributes used with <IMG> are:
- Align
- Height and width
- Vspace and hspace
- Alt
- Border
a) ALIGN:
used to set the alignment of the text adjacent to the image. It takes the following values:
• ALIGN = LEFT - Displays image on left side and the subsequent text flows around
the right hand side of that image
• ALIGN = RIGHT - Displays the image on the right side and the subsequent text
flows around the left hand side of that image
• ALIGN = TOP - Aligns the text with the top of the image
• ALIGN = MIDDLE - Aligns the text with the middle of the image
• ALIGN=BOTTOM - Aligns the text with the bottom of the image
Height and Width of an image can be controlled by using the height and width attributes in the
<IMG> tag as follows:
White space around an image can be provided by using hspace (Horizontal Space) and vspace
(Vertical Space) attributes of the <IMG> tag. These attributes provide the space in pixels.
This attribute is used to give alternative text that can be displayed in place of the image. This is
required when the user needs to stop display of images while retrieving a document in order to
make the retrieval faster, or when the browser does not support graphics. It is also used a tool
tips – displaying description of the image when the mouse is over the image.
e) BORDER
Border around the image can be controlled by using BORDER attribute of <IMG> tag. By
default image displays with a thin border. To change the thickness or turn the border off, the
value in pixels should set to BORDER attribute. E.g.<IMG SRC=NOSlogo.GIF BORDER=0>
Example
<html>
<head>
<title> use of img tag with its align attribute</title>
</head>
<body>
<p>
<img src="placide/profile.jpg" align=top> aligns the text with the top
of the image
</p>
<p>
<img src="placide/profile.jpg" align=middle> aligns the text with the
middle of the image
</p>
<p>
<img src="placide/profile.jpg" align=left> displays image on left side
and the subsequent text flows around the right hand side of that
image. displays image
on left side and the subsequent text flows around the right hand side
of that image. displays image on left side and the subsequent text
flows around the right hand side of that image.
</p>
<p>
<img src="placide/profile.jpg" align=right> displays image on right
side and the subsequent text flows around the left hand side of that
image. displays image on right side and the subsequent text flows
around the left hand side of that image.
</p>
</body>
</html>
HREF (Hyper Link Reference) is a mandatory attribute used to refer the URL of the resource.
URL (Uniform Resource Locator) is an address tells the browser about the file to link to. It
identifies file locations (Addresses) on the web or on the local hard drive. These addresses can be
those of HTML documents or elements such as images, scripts, applets and other files. It is
always enclosed in quotes.
<a HREF ="page2.htm">next page</a> create a link to a webpage in the same folder
1. <A HREF="#section_name"> link to another section of the same document </A> This
link text jumps to the section named with HREF on click. The #symbol before the section
name is must.
2. <A NAME="section_name"> Beginning of the section </A> The NAME attribute is
used to identify a section with a name. It is a unique identifier within the document for
the anchor. One can also jump to a specific section of different document specifying the
path on HREF attribute.
Example:
Example
<HTML>
<HEAD>
<TITLE> Use of Anchor Tag</TITLE>
</HEAD>
<BODY>
<H2 align="center"><U><FONT COLOR="BLUE">National Institute of Open
Schooling</FONT> </U></H2>
<A HREF="http://placide.blog4ever.com"><IMG SRC="placide/profile.jpg"
alt="Jesus is love" align="left"></A>
The success of open learning and distance education very much depends on
the harnessing of the new and latest technology. The emerging Internet and
Web Technology helps in effective dissemination of information. The web
site isa demand source of latest information. One can access NIOS website
by clicking on <A HREF="http://www.placide.blog4ever.com" >Blog de
planette</A> OR on Clicking on my picture.
You can also contact me by clicking here <a
href="mailto:[email protected]">Contact me by mail</a>
<p></p><p></p><p></p><p></p>
<p><b><i><u>Internet and Web Technology</u></i></b></p>
<p><FONT COLOR="BLUE">Various Terms used in Internet are:</FONT><br>
<ol type = "i">
<li><A HREF="#HTML"> HTML(Hypertext Markup Language) <br>
<li><A HREF="#WWW">WWW(World Wide Web)<br>
<li><A HREF="#site">Web site</A>(Linking within the document)<br>
</P>
<P></P><P></P><P></P>
<A NAME="HTML">HTML (Hypertext Markup Language)<a> <hr align="left"
width="24%" noshade> HTML (Hypertext Markup Language), Language used to
create document on the World Wide Web. It is simply a collection of certain
key words called Tags
Example
<html>
<head>
<title>My First Web Page </title>
</head>
<body>
<table border = "5" width="90%" cellpadding="5" cellspacing="0" >
<tr bgcolor="#EDDD9E">
<td width="200" valign="top"><img src="placide/profile.jpg"
width="100" height="100"></td>
<td valign="top"><h1 align="right">Placide DZEUGANG</h1>
<h3 align="right">Computer Scientist</h3></td>
</tr>
<tr>
<td width="200">
<h3>Menu</h3>
<ul>
<li><a href="home.html">Home</a></li>
<li> <a href="faq.html">FAQ</a></li>
<li> <a href="contact.html">Contact</a></li>
<li> <a href="http://www.placide.blog4ever.com">My Blog</a>
</li>
</ul>
</td>
<td valign="top">
<h2 align="center">Welcome!</h2>
<p>Welcome to my first webpage. I created this webpage without the
assistance of a
webpage editor. Just my little text editor and a keen understanding
of html.</p>
<p>Look around. Notice I'm able to use paragraphs, lists and
headings. You may not
be able to tell, but the layout is done with a table. I'm very
clever. </p>
<blockquote>
<p>I always wanted to be somebody, but now I realize I should have
been more specific.</p>
<cite>Lily Tomlin </cite> </blockquote>
</td>
</tr>
</table>
<hr width="90%" align="left">
<address>
Placide DZEUGANG<br>
Computer Scientist<br>
512.555.5555
</address>
<p>Contact me at <a href="mailto:[email protected]">[email protected]</a>
</p>
</body>
</html>