HTML 2016)
HTML 2016)
HTML
Academic year: 2015-2016
FEB- 2016
1
East Africa University
Faculty of Business Administration
Course Outline of HTML
3
References
Html5&css Develop with tomorrow brain p.hogan
Html5 for web designers jeremy kieth
Websites
1. www.whatwg.org
2. www.webcamtoy.com
3. www.html5rocks.com
4. www.html5demos.com
5. www.w3shools.com
4
Introduction to Web
History of the Web
Web terminology
1. HTML Introduction
2. Building a first html document
3. Structure of the web documents
4. History of HTML
1- HTML Introduction
HTML or Hypertext Markup Language is the most widely
used language on Web. Technically, HTML is not a
programming language, but rather a markup language.
Hypertext refers to the way in which Web pages (HTML
documents) are linked together. When you click a link in a
Web page, you are using hypertext.Markup Language
describes how HTML works. With a markup language, you
simply "markup" a text document with tags that tell a Web
browser how to structure it to display.
Originally, HTML was developed with the intent of defining
the structure of documents like headings, paragraphs, lists,
and so forth to facilitate the sharing of scientific information
between researchers.
Pre - Requirement
However, for learning HTML we recommend a text editor like Notepad (PC)
Follow the 4 steps below to create your first web page with Notepad.
Click Start (bottom left on your screen). Click All Programs. Click Accessories
. Click Notepad.
Open the Start Screen (the window symbol at the bottom left on your screen).
Type Notepad.
Example 9
<! DOCTYPE html>
<html>
<body>
</body>
</html>
You can use either .htm or .html as file extension. There is no difference, it is up
to you.
Double-click your saved HTML file, and the result will look much like this:
10
STRUCTURE OF HTML FILES TAGS
<HTML> and </HTML> tags
Thus <HTML> tells the browser that what follows is an HTML document an
Each web page must have the HEAD tag that give
information to a person visiting your website
11
The TITLE of your web page must occur between the
<TITLE> and </TITLE> tags and you are only allowed one
TITLE element per page
It contains all the text and tags. It is the part that will be
displayed on the browser screen. Thus the BODY element
contains the actual contents of the document.
<BR>
<BR> tells your browser to go to the beginning of the next line
. BR stands for line Break. <BR> acts in the same way as the ENTER key
on your keyboard.
<P>
<P> for Paragraph tells your browser to insert a blank or empty line and th
begin a new line
(a new paragraph).
<HR>
<HR> puts a line across the page. HR stands for Horizontal Rule.
Example
<HTML>
<HEAD>
<TITLE>WEB PAGE DESIGN - BASIC TAGS</TITLE>
</HEAD>
<BODY>
<p> ICS. Courses<p> <BR>
<p> html for web programming </p>.<HR>
<p> programming languages like c ,c++</p><br>
address <BR>
12
<B>behinds of Gools <B/>
</BODY>
</HTML>
HEADER TAGS
There are only six HEADER tags and they range from H1 to H6.
H1 produces the largest size heading and is called the "level 1 heading"
H6 produces the smallest size heading and is called the "level 6 heading
EXAMPLE :
<HTML>
<HEAD>
<TITLE>HEADING LEVELS</TITLE>
</HEAD>
<BODY>
<H1>THIS IS H1.</H1> THIS IS NORMAL SIZE.
<H2>THIS IS H2.</H2> THIS IS NORMAL SIZE.
<H3>THIS IS H3.</H3> THIS IS NORMAL SIZE.
<H4>THIS IS H4.</H4> THIS IS NORMAL SIZE.
<H5>THIS IS H5.</H5> THIS IS NORMAL SIZE.
<H6>THIS IS H6.</H6> THIS IS NORMAL SIZE.<HR>
</BODY>
</HTML>
13
<P ALIGN="CENTER">a paragraph or block of text goes
here</P>
HTML Comment Tag
Example:
Html tags you type in your text To get large print, centered text,
text,
Bold text
Italic text
Emphasized text
Marked text
Small text
Deleted text
Inserted text
Subscripts
Superscripts
Example:
Example:
Example:
Example:
Example:
Example:
Example:
Example
<p>This is <sup>superscripted</sup> text.</p>
17
HTML Text Fonts
EXAMPLE
<Html>
<body>
<h1 style="font-family:verdana">This is a heading</h1>
<p style="font-family:courier">This is a paragraph.</p>
</body>
</html>
<html>
<body>
<h1 style="font-size:300%">This is a heading</h1>
<p style="font-size:160%">This is a paragraph.</p> </body>
</html>
Syntax: <pre>---------------</pre>
Example:
<html>
<title>
Pre formated Tag
</title>
<head>
<b><h1 align="center">I am Learning Web Language
HTML</b></h1>
</head>
<body>
<pre>
Text in a pre-element is displayed
in a fixed-width font,
and it preserves both spaces and
line breaks
</pre> </body> </html>
HTML Styles
Every HTML element has a default style (background color is white, text color
is black, text-size is 12px ...)
Changing the default style of an HTML element, can be done with the style
attribute.
This example changes the default background color from white to lightgrey:
<body style="background-color:lightgrey">
19
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
HTML Text Color
The color property defines the text color to be used for an HTML
element:
<html>
<body>
<h1 style="color:blue">This is a heading</h1>
<p style="color:red">This is a paragraph.</p>
</body>
</html>
Font color
HTML colors are defined using a hexadecimal (hex) notation for the
combination of Red, Green, and Blue color values (RGB).
The lowest value that can be given to one of the RGB is 0 (hex 00). The highest
value is 255 (hex FF).
Hex values are written as 3 double digit numbers, starting with a # sign.
Note that HTML does not have separate tag for setting colors. Colors come as
attributes of some tags, such as <BODY>,
20
HTML supports 16.88 million unique color definitions.
RGB Colors
RGB color values are supported in all browsers.
Each parameter (red, green, and blue) defines the intensity of the color as an
integer between 0 and 255.
For example, rgb(0, 0, 255) is rendered as blue, because the blue parameter is
set to its highest value (255) and the others are set to 0.
<!DOCTYPE html>
<html>
<style>
padding: 20px;
}</style>
</div> </body></html>
21
Summary
HTML Text Formatting Elements
Tag Description
<b> Defines bold text
<em> Defines emphasized text
<i> Defines italic text
<small
Defines smaller text
>
<stron
Defines important text
g>
<sub> Defines subscripted text
<sup> Defines superscripted text
<ins> Defines inserted text
<del> Defines deleted text
<mark Defines marked/highlighted
> text
<font size="3" color="red">This is some text!</font>
<font size="2" color="blue">This is some text!</font>
<font face="verdana" color="green">This is some
text!</font>
22
HTML <marquee> Tag
The HTML <marquee> tag is used for scrolling piece of text or image
displayed either Horizontally across or vertically down your web site page
Syntax
</marquee>
Example
<html>
<head>
</head>
<body>
</body>
</html>
23
The <marquee> Tag Attributes
Following is the list of important attributes which can be used with <marquee> tag.
Attribute Description
This specifies the width of the marquee. This can be a value like 10 or 20%
width
etc.
This specifies the height of the marquee. This can be a value like 10 or 20%
height
etc.
This specifies the direction in which marquee should scroll. This can be
direction
value like up, down, left or right.
This specifies the type of scrolling of the marquee. This can have a value like
behavior
scroll, slide and alternate.
This specifies how long to delay between each jump. This will have a valu
scrolldelay
like 10 etc.
This specifies how many times to loop. The default value is INFINITE, which
bgcolor This specifies background color in terms of color name or color hex value.
This specifies horizontal space around the marquee. This can be a value lik
hspace
10 or 20% etc.
This specifies vertical space around the marquee. This can be a value like 10
vspace
or 20% etc.
Example 2
<html>
24
<head>
</head>
<body>
</body> </html>
Example 3
<html>
<head>
</head>
<body>
</body> </html>
Example 4
<html>
<head>
</head>
25
<body>
</body>
</html>
Example 5
<html> <head>
</head> <body>
26
UNIT 4: CREATING LISTS AND TABLES AND
HYPERLINKs
CREATING LISTS
Definition list: A list that defines glossary list, terms and its
definition.
Un-ordered Lists
The first, <UL> and </UL>, defines the beginning and end of
the entire list.
The second, <LI> and </LI> defines each item within the list.
<html>
<Body>
</Ul>
</body>
</html>
Value Description
disc Default. A filled circle
circle An unfilled circle
square A filled square
Example
<ul type="square">
<li>Coffee</li> <li>Tea</li> <li>Milk</li>
</ul>
The first, <OL> and </OL>, defines the beginning and end of
the entire list. The second, <LI> and </LI> defines each item
within the list.
<html>
28
<Head> <title> ordered Lists</title> <head>
<Body>
<ol>
<li> pen</li>
<li> book</li>
<li> mobile</li>
</ol>
</body>
</html>
Value Description
Specifies that the list order
Reversed
should be descending (9,8,7...)
Start(number) Specifies the start value of an
ordered
type Specifies the kind of marker to
use in the list
Example
29
<ol type="I">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
30
Definition list
The first, <DL> and </DL>, defines the beginning and end of
the entire list.
The second, <DT> and </DT> defines each term within the list.
<html>
<Body>
<Dl>
<dt> html</dt>
31
CREATING TABLES
Tables are commonly used to create three-column and two-
column
newsletter layouts.
you will first learn about the table tags shown in the following
table:
<html>
32
<head>
<title>HTML Tables</title>
</head>
<body>
<table border="1">
<tr>
</tr>
<tr>
</tr>
Table Heading
Table heading can be defined using <th> tag. This tag will be
put to replace
<html>
<head> 33
<title>HTML Table Header</title>
</head>
<body>
<table border="1">
<tr>
<th>Name</th>
<th>Salary</th>
</tr>
<tr>
<td>Asad</td>
<td>5000</td>
</tr><tr>
<td>Hussein</td><td>7000</td></tr>
</table>
</body>
</html>
<html>
<head>
</head>
<body>
<tr>
<th>Name</th>
<th>Salary</th>
</tr>
<tr>
<td>Ramesh Raman</td>
<td>5000</td>
</tr>
<tr>
<td>Shabbir Hussein</td>
<td>7000</td>
</tr> 35
</table>
</body></html>
You will use colspan attribute if you want to merge two or more
columns into a single column. Similar way you will use rowspan
if you want to merge two or more rows.
<html>
<head>
</head>
<body>
<table border="1">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</table></body> </html>
Table Caption
The caption tag will serve as a title or explanation for the table
<html>
<head>
</head>
<body>
<tr>
</tr>
<tr>
</tr>
</table></body>
</html>
37
38
Table Header, Body, and Footer
The three elements for separating the head, body, and foot of a
table are:
Example
<html>
<head>
<title>HTML Table</title>
</head>
<body>
<thead>
<tr>
</tr>
39
</thead><tfoot>
<tr>
</tr>
</tfoot>
<tbody>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
<td>Cell 4</td>
</tr>
</tbody>
</table>
</body>
</html>
40
CREATING HYPERLINKS
Linking Documents
<Html>
<head>
<title>Hyperlink Example</title>
</head>
<body>
<p>Click following link</p>
<a href="FIRST.PAGE" target="_self">MYPAGE</a>
</body>
</html>
41
The target Attribute
Optio
Description
n
_paren
Opens the linked document in the parent frame.
t
<html>
<head><title>Hyperlink Example</title>
</head> <body>
First create a link to the place where you want to reach with-in
a webpage and name it using <a...> tag as follows:
This will produce following link, where you can click on the link
generated Go to the Top to reach to the top of the HTML Text
Link tutorial.
Example
<html>
<head>
<title>Hyperlink Example</title>
<base href="http://www.tutorialspoint.com/">
</head>
</body>
</html>
44
Image Links
We just need to use an image inside hyperlink at the place of
text
<Html>
<head>
<title>Hyperlink Example</title>
</head>
<body>
45
E-Mail Links:
Many sites include hyperlinks that will launch a users e-mail
application and create a new e-mail message. The new e-mail
message will be automatically addressed to the individual(s)
defined by the hyperlink.
46
47
UNIT 5: WORKING WITH IMAGES AND USING
AUDIO AND VIDEO
1. Inserting images to your html files
2. Inserting audio and sound formats
3. Inserting video and video formats
INSERTING IMAGES
HTML Images Syntax
In HTML, images are defined with the <img> tag.
The <img> tag is empty, it contains attributes only, and does not have
a closing tag.
The src attribute defines the url (web address) of the image:
Example
<Html>
<HEAD> <TITLE> SAWIRR</TITLE></HEAD>
<body>
<h2>SAWIKAN EEG </h2>
<img src="ABC.jpeg" alt="SAWIR View"
style="width:304px;height:228px">
</body>
</html>
49
MULTIMEDIA IN HTML
Before HTML5, audio files could only be played with a plug-in (like
flash).
Internet Explorer 9+, Firefox, Opera, Chrome, and Safari support the
<audio> element.
<html>
<head>
<TITLE> vidoi</title>
</head>
<body>
<h1> KU SOO DHAWAAW GABayGAN WACAN </h2>
<audio controls>
<source src="xaq.mp3" type="audio/mpeg">
50
Your browser does not support the audio element.
</audio> </body> </HTML>
Note: HTML Audio - How It Works
The controls attribute adds audio controls, like play, pause, and
volume.
Text between the <audio> and </audio> tags will display in browsers
that do not support the <audio> element.
File
Media
Forma
Type
t
audio/mp
MP3
eg
audio/og
Ogg
g
audio/wa
Wav
v
EXAMPLE
<html> 51
<head>
<TITLE> vidoi</title>
</head>
<body>
Gabaygan
<video width="320" height="240" controls>
<source src="1234.mp4" type="video/mp4">
</video> </body> </HTML>
File Media
Format Type
video/mp
MP4
4
video/web
WebM
m
video/og
Ogg
g
52
UNIT 6 CREATING FORMS AND FRAMES
Form controls are elements that allow the user to enter information such as text
fields, password fields, hidden buttons, radio buttons, checkboxes, text area
fields, drop-down menus, file uploads, buttons, submit button, image button,
reset button, etc.
You use <FORM> tag to enter form and it has closing tag
/FORM>.<FORM> tag attributes
Attribute Description
Form Controls
<INPUT> Tag
The <INPUT> tag is used to create a number of controls. You use the
TYPE attribute to specify the specific type of control. This attribute
and others are summarized in the following table:
<CENTER><B>Application Form</B></CENTER>
<FORM>
</FORM>
</BODY>
57
<SELECT> Tag
Using the <SELECT> tag with the SIZE attribute of 1 will generate a
dropdown control. Using a SIZE attribute greater than 1 will generate
a listbox control.
Both the listbox and dropdown controls are useful in providing the
user with a long list of options to choose from. Dropdown controls
allow the user to select only one item from the list, while the listbox
controls can be configured to allow multiple selections.
The following table shows the attributes available for the <SELECT>
tag.
Attribute Description
NAME Sets the name of the control. The name of the control
gets passed along to the Web server to help you
identify the data.
58
Between the opening and closing tags of <SELECT> there are one or many
<OPTION> tags. Each <OPTION> tag represents one item in the list. Between
the opening and closing <OPTION> tags is the string you wish to include as
that item and they will be ordered in the order they appear between the
<SELECT> tags.
<TEXTAREA> Tag
The text control created by the <INPUT> tag cannot accept carriage
returns because it is a single-line control. If you need to allow your users to
enter multi-line text-based data, like for a comments field or for shipping
instructions, you need to use the textarea control.
The <TEXTAREA> tag includes ROWS and COLS attribute to allow you to set
the width and height of the control. These attributes do not limit the number of
characters the user can enter; it simply defines how many characters the user
can see at one time. Between the opening and closing <TEXTAREA> tag,
include any content you would like to appear within the textarea control as a
default.
<BODY>
<CENTER><B>Application Form</B></CENTER>
<FORM>
<B>Secondary school:
<OPTION>Najah<OPTION>Al-Waha
<OPTION>Qardho<OPTION>Baran<OPTION>Al-Furqan
</SELECT><BR>
59
Other comment: <BR><TEXTAREA ROWS = "15" COLS =
"20">Further information</TEXTAREA><BR><P><P>
</FORM>
</BODY>
60