Chapter 1 - Introduction To HTML I
Chapter 1 - Introduction To HTML I
Create, format and edit lists using html and create hyperlinks
to resources
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo
Forgor
World Wide Web Consortium – W3C
HTML is an open-source language controlled by a private central
authority, the World Wide Web Consortium, or W3C.
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo
Forgor
HTML Tags (3)
Browsers ignore all extra spaces and carriage
returns within a HTML document.
Why?
Browsers have to reformat the document to fit in
the current display area.
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
HTML Tags (4)
Some tags can have one or more (named)
attributes to define some additional characteristics
of the tag.
eg.
<img src=“baby.jpg”>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo
Forgor
HTML Tags (5)
Unrecognized tags
Browsers normally ignore tags it does not recognize.
Comment lines
Comments are included between
<!--- and --->.
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo
Forgor
HTML Editors
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo
Forgor
The WYSIWYG Editors
Stands for What You See Is What You Get
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
The Text Editors
Uses various levels of HTML coding
Notepad
Notepad++ – free text editor that uses colors on
coding
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Creating an HTML document
Open any text editor – Note pad
In the file name type a “file name dot html” eg:
mysite.html
Click SAVE
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
The Structure of HTML pages
<! DOCTYPE html>
<html>
<head>
<title>
</title>
</head>
<body>
</body>
</html>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
A Simple HTML Document
<! DOCTYPE html>
<html>
<head>
<title> Title of the Document </title>
</head>
<body text=“white” bgcolor=“blue”>
This is the content of the document.
This is an <i> italic </i> font.
</body>
</html>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Structural HTML Tags
<!DOCTYPE>
HTML5 has only one <!doctype> declaration:
<!DOCTYPE html>
This is to say that "this page is written in HTML5"
It must be the first thing on the page
Attributes:
lang = language code
fr –Internet
ICT453: French, ru – Russian,
Technologies en – -English
and Web Design etc.
GTUC 2013 Delivery #Lempogo Forgor
Structural HTML Tags (2)
<head> ……. </head>
Used to provide information about a web page.
<base>
Attribute: href=url
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Structural HTML Tags (3)
<meta>
Used to provide information about a document.
Attributes:
background=url
specifies an image file to be used as tiling background.
bgcolor=color
Sets the background color of the document.
text=color
Sets the default color for the normal text in the document.
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Structural HTML Tags (5)
More <body> Attributes:
alink=color
Sets the color of active links.
link=color
Sets the default color for all the links in a
document.
vlink=color
Sets the color for the visited links.
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
How to specify colors
The two methods of specifying colors are:
Example:
<body text=“#FFFFFF”
bgcolor=“#0000FF”>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
How to specify colors (2)
2. By specifying the color name.
Example:
<body text=white>
<body bgcolor=“yellow”>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Text Formatting in HTML
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo
Forgor
Paragraphs and Headings
<P>
Example:
This is the first line. <br>
This is the second line. <br>
This is the third.
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
The Horizontal Line tag
<HR>
Produces a horizontal line, which can be used to delimit
sections.
Length of the line can be specified.
Examples:
<hr>
<hr size=“20”>
<hr width=“75%”>
<hr align=“right” width=120>
Across full width of browser, 20 pixels thick, 75% of available page
width, and 120 pixels right-justified.
<hr noshade>
<hr color=“blue” noshade>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Appearance of Text
<b> ……. </b>
Displays the enclosed text in bold.
Example:
<pre>
main()
{
int i, j;
abc ();
}
</pre>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Appearance of Text
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo
Forgor
Example 1
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo
Forgor
Types of Lists
There are a number of tags for building lists.
Serves the purpose of improving the readability
of the text.
Unnumbered list
Numbered list
Definition list
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Unnumbered List
Unnumbered or unordered lists are used when the
sequence of the items is not very important.
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Unnumbered List (2)
Type attributes
Shared by both <UL> and <LI> tags
Specifies the type of bullets to use
Can be
Circle
Disc – by default
square
Example:
<UL>
<LI> First item of the list
<LI> Second item of the list
<LI> Third item of the list
</UL>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Unnumbered List (Example 1)
<! DOCTYPE html>
<html> <head><title> Bulleted list 1 </title></head>
<body text=white bgcolor=blue>
<h2> The flowers I like: </h2>
<h3>
<UL>
<LI> Rose
<LI> Lotus
<LI> Daffodil
<LI> Marigold
</UL>
</h3>
</body>
</html> ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Unnumbered List (Example 2)
<! DOCTYPE html>
<html> <head><title> Bulleted list 1 </title></head>
<body text=white bgcolor=blue>
<h2> The flowers I like: </h2>
<h3>
<UL type=disc>
<LI> Rose
<LI> Lotus
<LI type=square> Daffodil
<LI> Marigold
</UL>
</h3>
</body>
</html>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Numbered List
Numbered or ordered lists are used when the sequence
of the items is important.
Attributes:
type = 1 | A | a | i | I
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Numbered List (Example 1)
<! DOCTYPE html>
<html> <head><title> Numbered list 1 </title></head>
<body text=white bgcolor=blue>
<h2> To cook rice you must: </h2>
<h3>
<OL>
<LI> Put some water to boil
<LI> Put some rice
<LI> Wait for 30 minutes
<LI> Serve in a plate
</OL>
</h3>
</body> </html>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Numbered List (Example 2)
<! DOCTYPE html>
<html><head><title> Numbered list 1 </title></head>
<body text=white bgcolor=blue>
<h2> To cook rice you must: </h2>
<h3>
<OL type=A>
<LI> Put some water to boil
<LI> Put some rice
<LI> Wait for 30 minutes
<LI> Serve in a plate
</OL>
</h3>
</body>v</html>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo
Forgor
Numbered List (Example 3)
<! DOCTYPE html>
<html> <head><title> Numbered list 1 </title></head>
<body text=white bgcolor=blue>
<h2> To cook rice you must: </h2>
<h3>
<OL type=I>
<LI> Put some water to boil
<LI> Put some rice
<LI type=1> Wait for 30 minutes
<LI> Serve in a plate
</OL>
</h3>
</body> </html>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Definition List
Specified using the tag:
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Definition List (2)
Example:
<DL>
<DT> TCP
<DD> Transmission Control Protocol
<DT> UDP
<DD> User Datagram Protocol
<DT> IP
<DD> Internet Protocol
</DL>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Nesting of Lists
Any list can be nested within another list.
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Nesting of Lists (Example 1)
<! DOCTYPE html>
<html><head><title> List Nesting 1 </title></head>
<body text=white bgcolor=blue>
<H3> My favorite languages are:
<UL>
<LI> Java <BR>
<UL>
<LI> object-oriented
<LI> platform independent
<LI> can be embedded within HTML
</UL> <BR>
<LI> Perl <BR>
<UL>
<LI> a scripting language
<LI> powerful string handling capabilities
<LI> widely used for writing CGI scripts
</UL>
</UL> </H3>
</body></html> ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery
Nesting of Lists (Example 2)
<! DOCTYPE html>
<html><head><title> List Nesting 2 </title></head>
<body text=white bgcolor=blue>
<H3> My favorite languages are:
<OL>
<LI> Java <BR>
<UL>
<LI> object-oriented
<LI> platform independent
<LI> can be embedded within HTML
</UL> <BR>
<LI> Perl <BR>
<OL>
<LI> a scripting language
<LI> powerful string handling capabilities
<LI> widely used for writing CGI scripts
</OL>
</OL> </H3>
</body></html> ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery
#Lempogo Forgor
Using Some Special Characters
In HTML
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Special Characters in HTML
HTML Entities - Special combination of Keyboard
characters.
HTML Entities can be placed in an HTML code to
produce special characters and symbols that cannot
be generated in HTML with normal keyboard
commands.
Remember!
Codes for special characters are case sensitive
All these special character must begin with an
ampersand and ended with a semicolon (;)
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Special Characters in HTML
Symbols HTML Entity Name
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Hyperlinks
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Hyperlinks (2)
Specified using the anchor tag:
<A> ……. </A>
Requires an attribute called “HREF” which
specifies the path of the resource to be linked.
Example:
<a href=“face.jpg”> portrait </a>
<a href=http://www.google.com> search </a>
<a href=“mailto:[email protected]”> Mail me </a>
<a href=introduction.pdf> download Slides </a>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo
Forgor
Relative versus Absolute URLs
Relative URL
Examples:
<a href=“tennis/nadal.html”> Nadal </a>
<a href=“../news/cricket.html”> Cricket </a>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Relative versus Absolute URLs (2)
Absolute URL
Example:
<a href=http://www.yahoo.com> Go to Yahoo </a>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Linking to Specific Sections
Anchors can be used to go to a particular section in
a document.
Within the same (or different) document.
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Hyperlinks (Example)
<! DOCTYPE html>
<html><head><title> Link to Other Sites </title></head>
<body text=white bgcolor=pink link=red vlink=green>
My favorite search engines are:
<ol>
<li> <a href="http://www.google.com"> Google </a> </li>
<li> <a href="http://www.yahoo.com"> Yahoo </a> </li>
<li> <a href="http://www.yandex.ru"> Yandex </a> </li>
</ol>
<hr>
<address>
Mr. Kofi Manu<BR> <BR>
<a href="mailto:[email protected]"> Mail Me </a>
</address>
</body></html>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Web Graphics
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
HTML and Images
Supported image formats: JPEG, GIF, PNG
Specified using the standalone tag:
<IMG>
Attributes of <IMG>:
SRC:
specifies the URL of the image file
HEIGHT:
height (in pixels) to be set aside for the image.
WIDTH:
width (in pixels) to be set aside for the image.
ALT:
Specifies an alternate text for an image
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
HTML and Images (2)
The HEIGHT and WIDTH attributes tells the
browser to set aside appropriate space (in
pixels) for the image as it downloads the rest
of the file.
Some browsers stretch or shrink an image to
fit into the allotted space.
Example:
<IMG SRC=blackrose.gif>
<img src=tiger.jpg height=80 width=150>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Example 1
<! DOCTYPE html>
<html><head></head><body>
</body></html>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Images (Example 2)
<! DOCTYPE html>
<html><head></head><body>
<img src =book.gif align ="left" width="48” height="48">
A paragraph with an image. The image will float to the left of
this text.
<p>
<img src =book.gif align ="right" width="48“ height="48">
A paragraph with an image. The image will float to the right of
this text.
</body>
</html>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Images (Example 3)
<! DOCTYPE html>
<html><head></head><body>
<img src="book.gif" width="20" height="20"> <p>
<img src="book.gif" width="45" height="45"> <p>
<img src="book.gif" width="70" height="70"> <p>
Resizing an image by changing the values in the "height" and
"width"
attributes of the img tag.
</body>
</html>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Images (Example 3)
<! DOCTYPE html>
<html><head></head><body>
It is possible to use an image as a link. Click on the image
below to go to google.
<P>
<a href=“www.google.com"> <img src=book.gif></a>
</body>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
HTML5 Video Series
Video and Audio Media in HTML5
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo
Forgor
HTML5 Video Series
Video and Audio Media in HTML5
We finally have a simple way to include
videos and audio clips in web pages
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
HTML5 Video Series
Types of Media (MIME Types)
VIDEO AUDIO
Mp4 Mp3
WebM Ogg
Ogg
Wav
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
HTML5 Video Series
Video Tags
<video> - Define a video
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Video Tags (Example 3)
<! DOCTYPE html>
<html><head></head><body>
</video>
</body> </html>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
HTML5 Video Series
Audio Tags
<audio> - Define sound content
<source> - Defines multiple sources for the audio
element
<html><head></head><body>
<audio id=“myAudio" controls>
<source src=“audio/audio.mp3" type=“audio/mpeg">
Your browser does not support the video tag.
</audio>
</body> </html>
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
HTML5 Video Series
Browser Support
The following browsers support HTML5 video
an audio
IE9+
Chrome 6+
Firefox 3.6+
Safari 5+
Opera 10.6+
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo
Forgor
HTML5 Video Series
Javascript Audio/Video Methods
addTextTrack() – Adds a new track
canPlayType() – Checks if browser can play
type
load() - Re-loads the audio/video element
play() - Starts playing the audio/video
pause() - Pauses the playing audio/video
ICT453: Internet Technologies and Web Design - GTUC 2013 Delivery #Lempogo Forgor
Any Questions