Professional Documents
Culture Documents
INSY214 Chapter4
INSY214 Chapter4
CHAPTER 4
LOGO
Contents
4.1 Lists
4.1.1 Ordered Lists
4.1.2 Unordered Lists
4.1.3 Definition Lists
4.1.4 Nested Lists
4.2 Tables
2
D Gichuki
4.1 LISTs
▪ Ordered Lists
▪ Unordered Lists
▪ Definition Lists
▪ Nested Lists
3
D Gichuki
4.1 LISTs
❖ An ordered list starts with the <ol> tag and finishes with
</ol> tag.
<ol type=“a”>
<li>Apples</li> a. Apples
<li>Bananas</li> b. Bananas
<li>Coconuts</li> c. Coconuts
</ol>
5
D Gichuki
4.1 LISTs
<ul>
<li>Apples</li> • Apples
<li>Bananas</li> • Bananas
<li>Coconuts</li> • Coconuts
</ul>
6
D Gichuki
4.1 LISTs
<ul type=”square”>
<li>Apples</li> ▪ Apples
<li>Bananas</li> ▪ Bananas
<li>Coconuts</li> ▪ Coconuts
</ul>
7
D Gichuki
4.1 LISTs
8
D Gichuki
4.1 LISTs
<dl>
<dt>Internet Explorer</dt>
<dd>Developed by Microsoft</dd>
<dt>Netscape</dt>
<dd>Developed by Netscape</dd>
</dl>
Internet Explorer
Developed by Microsoft
Netscape
Developed by Netscape
9
D Gichuki
4.1 LISTs
10
D Gichuki
4.2 TABLEs
❖ Tables are used when you need to show "tabular data" i.e.
information that is logically presented in rows and columns.
❖ TABLE Attributes;
▪ BORDER: lets you set the width of the table’s border in pixels
▪ ALIGN: specifies the horizontal alignment of the content in
the entire table, in a row or in a single cell. For example, left,
center or right.
▪ WIDTH: pixels (absolute) or a percentage
▪ VALIGN: specifies the vertical alignment of the content in a
cell. For example, top, middle or bottom.
11
D Gichuki
4.2 TABLEs
❖ TABLE Elements
▪ THEAD element
• Header info
• For example, titles of table and column headers
▪ TBODY element
• Used for formatting and grouping purposes
12
D Gichuki
4.2 TABLEs
❖ <TR>…</TR>
▪ stands for "table row"
▪ starts and ends horizontal rows.
❖ <TH>…</TH>
▪ suitable for titles and column headings
▪ used in the header part of a table.
▪ all major browsers will display the text in the
<th> element as bold and centered.
13
D Gichuki
4.2 TABLEs
❖ <TD>...</TD>
❖ stands for "table data".
❖ starts and ends each cell in the rows of the table.
❖ holds the content of a data cell.
❖ used in the body part of a table.
❖ aligned left by default.
❖ a <td> tag can contain
▪ text,
▪ links,
▪ images,
▪ lists,
▪ forms,
14
▪ other tables, etc.
D Gichuki
4.2 TABLEs
15
D Gichuki
4.2 TABLEs
<html>
<body>
<h4>Horizontal Headers:</h4>
Horizontal Headers:
<table border="1">
<tr>
Name Telephone Telephone
<th>Name</th>
<th>Telephone</th> Bill Gates 555 77 854 555 77 855
<th>Telephone</th>
</tr>
<tr>
<td>Bill Gates</td>
<td>555 77 854</td>
<td>555 77 855</td>
</tr>
</table>
</body>
</html>
16
D Gichuki
4.2 TABLEs
<html>
<body>
<h4>Vertical Headers:</h4> Vertical Headers:
<table border="1">
<tr>
First Name: Bill Gates
<th>First Name:</th>
<td>Bill Gates</td> Telephone: 555 77 854
</tr> Telephone: 555 77 855
<tr>
<th>Telephone:</th>
<td>555 77 854</td>
</tr>
<tr>
<th>Telephone:</th>
<td>555 77 855</td>
</tr>
</table>
</body>
</html>
17
D Gichuki
4.2 TABLEs
<table border="1">
<caption> TABLE 1 </caption>
<THEAD>
<tr>
<th>Header 1</th> TABLE 1
<th>Header 2</th> Header 1 Header 2
</tr>
</THEAD> row 1, cell 1 row 1, cell 2
<TBODY> row 2, cell 1 row 2, cell 2
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</TBODY>
</table>
18
D Gichuki
4.2 TABLEs
<html>
<body>
<h4>Cell that spans two columns:</h4>
<table border="1">
<tr><th>Name</th>
<th colspan="2">Telephone</th></tr>
<tr> Cell that spans two columns:
<td>Bill Gates</td>
<td>555 77 854</td> Name Telephone
<td>555 77 855</td>
Bill Gates 555 77 854 555 77 855
</tr>
</table> Cell that spans two rows:
<h4>Cell that spans two rows:</h4> First Name: Bill Gates
<table border="1">
<tr><th>First Name:</th><td>Bill 555 77 854
Gates</td></tr> Telephone:
<tr><th rowspan="2">Telephone:</th>
555 77 855
<td>555 77 854</td>
</tr>
<tr><td>555 77 855</td></tr>
</table>
</body>
</html>
19
D Gichuki
4.2 TABLEs
❖ COLGROUP element
▪ Used to group and format columns
20
D Gichuki
4.2 TABLEs
21
D Gichuki
4.2 TABLEs
22
D Gichuki
4.2 TABLEs
23
D Gichuki
4.2 TABLEs
24
D Gichuki