Professional Documents
Culture Documents
Cs101 Lec09
Cs101 Lec09
Lecture 9
HTML Lists & Tables
(Web Development Lecture 3)
1
Today is our 3rd Web Dev lecture
During our 2nd lecture on Web dev …
1. We learnt to develop our own Web pages in HTML
3
But first …
A few comments on the general structure
of HTML tags
4
Single Tags
<tagName>
Example: <BR>
5
Single Tags with Atributes
<tagName attributes>
6
Paired Tags
<tagName> … </tagName>
7
Paired Tags with Attributes
8
9
10
List
11
Table
12
<HTML>
<HEAD>
<TITLE>Altaf Khan's Home Page</TITLE>
</HEAD>
<BODY>
<H1>Altaf Khan</H1>
</BODY>
13
</HTML>
<HTML>
<HEAD>
<TITLE>Altaf Khan's Home Page</TITLE>
</HEAD>
<BODY>
<H1>Altaf Khan</H1>
<UL>
<LI>SimCity</LI>
<LI>Quake</LI>
<LI>Bridge</LI>
</UL> Additional
<P>My favorite sports are:</P> code
<TABLE border = “1” >
<TR>
<TH>Indoor</TH>
<TH>Outdoor</TH>
</TR>
<TR>
<TD>Squash</TD>
<TD>Cricket</TD>
</TR>
</TABLE> 15
<P>My favorite PC games are:</P>
<UL> • SimCity
<LI>SimCity</LI> • Quake
<LI>Quake</LI> • Bridge
<LI>Bridge</LI>
</UL>
17
<UL> Un-ordered List
18
The default “bullet” for these lists
is a “disc”
19
HTML Code Browser Display
20
type = “square”
21
Q: What happens if I start a new
list without closing the original one?
<UL>
<LI>SimCity</LI>
<LI>Quake II</LI>
<UL>
<LI>SimCity 3000</LI>
<LI>Quake III</LI>
</UL>
<LI>Bridge</LI>
22
</UL>
Browser Display
1. Different bullets
2. Additional tab • SimCity
• Quake II
• SimCity 3000
• Quake III
• Bridge
23
Such structures, i.e., those in
which another starts before
the first list is finished, are
called Nested Lists
24
Types of Lists
In addition to un-ordered lists, HTML
supports two other types
– Ordered Lists
– Definition List
25
Ordered List Browser Display
OL
instead
<OL> of UL 1. SimCity
<LI>SimCity</LI> 2. Quake
<LI>Quake</LI> 3. Bridge
<LI>Bridge</LI>
</OL> Numbers
instead of discs,
circles or 26
squares
Ordered List Browser Display
27
Ordered List Types
type Result
“A” A, B, C, …
“a” a, b, c, …
“I” I, II, III, IV, …
“i” i, ii, iii, iv, …
“1” 1, 2, 3, …
28
Q: How would one start an ordered
list with something other than 1
Browser Display
25. SimCity
26. Quake
27. Bridge
29
Ordered List Browser Display
30
Definition List Browser Display
<DL> SimCity Ter
<DT>SimCity</DT> m
A great simulation
<DD>A great
simulation game in game in which one
which one build build cities
cities </DD>
Quake
<DT>Quake</DT> Definition
<DD> One of the One of the best of
best of the shoot- the shoot-em-up
em-up genre genre
</DD>
</DL> 31
<DL> Definition List
<DT> Term
<DD> Definition
32
• Ordered lists as well as definition
lists can be nested just like the
un-ordered lists
33
• Lists are one way of presenting data in a
an ordered or formal fashion
34
Browser Display
Indoor Outdoor
Squash Cricket
35
HTML Code Browser Display
• CELLPADING
– Determines the distance between the border of a cell and
the contents of the cell
– Example: <TABLE CELLPADDING = “3”>
• CELLSPACING
– Determines the empty spacing between the borders of two
adjacent cells
38
– Example: <TABLE CELLSPACING = “1”>
HTML Code Browser Display
• HEIGHT
– Example: <TABLE HEIGHT = “200”> 41
<TR> Attributes
• VLAIGN
– Determines the vertical alignment of the
contents of all of the cells in a particular row
– Possible values: Top, Middle, Bottom
– Example: <TR VALIGN = “bottom”>
42
<TH> & <TD> Attributes
• NOWRAP
– Extend the width of a cell, if necessary, to fit the contents of
the cell in a single line
– Example: <TD NOWRAP>
• COLSPAN
– No. of rows the current cell should extend itself downward
– Example: <TD COLSPAN = “2”>
• ROWSPAN
– The number of columns the current cell should extend itself
– Example: <TD ROWSPAN = “5”>
• VALIGN
43
– Same as that for <TR>
HTML Code Browser Display
<TABLE border=“1” >
<TR>
Indoor Outdoor
<TH colspan=“2”> Squash Cricket
Indoor Outdoor
</TH>
</TR>
<TR>
<TD>Squash</TD>
<TD>Cricket</TD>
</TR>
</TABLE> 44
Expenses Income
Year Quarter
Quetta Dubai Quetta Dubai
1 1,900 8,650 9,000 7,780
2 2,230 8,650 8,500 8,670
2001
3 4,000 8,650 9,900 9,870
4 2,200 8,650 9,800 9,900
1 7,780 8,650 7,780 9,000
2 8,670 8,650 8,670 8,500
2002
3 9,870 8,650 9,870 9,900
4 9,900 8,650 9,900 9,800
45
HTML Code Browser Display
http://www.netscape.com/assist/
net_sites/table_sample.html
48
In Today’s Lecture …
• We learnt how to extend our Web pages by
adding a few more tags