Lecture 2
Lecture 2
authoring
Introduction to HTML
Pre-requisites
<HTML>
<HEAD>
<TITLE> Example </TITLE>
</HEAD>
<BODY>
This is where you would include the text and
images on your Web page.
</BODY>
</HTML>
The <TITLE> Tag
The title of your Web page is very key and must
be chosen very careful;
displays…
TRAINS
Changing the Font
The expression <FONT FACE = “fontname”> …
</FONT> can be used to change the font of the
enclosed text
To change the size of text use the expression
<FONT SIZE=n> …. </FONT> where n is a
number between 1 and 7
To change the color, use <FONT
COLOR=“red”>…. </FONT>; The color can also
be defined using hexadecimal representation
( Example: #ffffff )
These attributes can be combined to change the
font, size, and color of the text all at once; For
example, <FONT SIZE=4 FACE=“Courier”
COLOR=“red”> …. </FONT>
Headings
HTML was originally intended to define the structure
of web documents, and Web pages are typically
organized into sections with headings. There are 6
heading levels in html with 1 being the largest so
that the most important heading should use a <H1>
tag; subheadings should use <H2> tags etc.. <h1>
defines the largest heading. <h6> defines the
smallest heading.
To create a heading use the expression <Hn>….</Hn>
where n is a number between 1 and 6
<H1>Level 1 heading</H1>
<H2>Level 2 heading</H2>
<H3>Level 3 heading</H3>
<H4>Level 4 heading</H4>
<H5>Level 5 heading</H5>
<H6>Level 6 heading</H6>
Use the HTML heading tags for headings only. Don't use
headings to make something BIG or bold.
Aligning Text
There are several ways of aligning text within
html. By default, text is ALIGNED to the left.
Any tag that creates a block of text is referred to
as a block tag. <H1>, <P> and <DIV> are all
examples of block tags. Each of these tags can
use an ALIGN attribute to align the contents of the
block of text. With this method you can align a
block of text to the center, left or right.
The ALIGN attribute can be inserted in the <P>
and <Hn> tags to right justify, center, or left
justify the text
For example, <H1 ALIGN=CENTER> Kampala
International University </H1> would create a
centered heading of the largest size for KIU.
<P ALIGN=”center”>All of this text would be
aligned to the Centre of the page</P>
Aligning Text
<DIV ALIGN=”center”>This text would appear in
the centre of the page</DIV>
<HTML>
<HEAD>
<TITLE> Example </TITLE>
</HEAD>
<BODY BGCOLOR=“black” TEXT=“white”>
<BASEFONT SIZE=7>
This is where you would include the text and
images on your Web page.
</BODY>
</HTML>
Lines
Many web pages use horizontal lines to divide the
page.
The <HR> tag is used to draw a line.
You can control the size (thickness in pixels) and
width (% of the window).
Examples:
<HR> {one pixel thick, 100% of window}
<HR SIZE=4 WIDTH=50%>
{4 pixels thick, 50% of window}
Attributes for the <HR> tag
WIDTH Can be specified in pixels or percentage of page
width <HR WIDTH=”150”> or <HR WIDTH=”80%”>
An unordered list is a
list of bulleted items
Here’s how it would
To create an unordered look on the Web:
list, type:
<UL>
<LI> First item in list
</LI>
<LI> Second item in
list</LI>
<LI> Third item in
list</LI>
</UL>
More on Unordered Lists...