Topic 2.3 Tables
Topic 2.3 Tables
HTML Table
2
HTML Table
<td>
<th>
<tr>
3
HTML Table
Basic Table Setting <body>
<!-- Basic table -->
<table border="1">
<tr>
<th>First</th>
Row 1 Column 3
<th>Lastname</th>
Table head
<th>Points</th>
</tr>
<tr>
<td>Jill</td>
Row 2 Column 3
<td>Smith</td> Table data
<td>50</td>
</tr>
</table>
4
HTML Table
Set Table
5
HTML Table
Cell Color
OUTPUT
6
HTML Table
• The cell padding attribute specifies the space, in pixels, between the cell wall and the cell
content.
• If you do not specify a padding, the table cells will be displayed without padding.
7
HTML Table
OUTPUT
8
HTML Table
<head> OUTPUT
<style>
table
{
border-spacing:5px;
}
</style>
</head>
9
HTML Table
Align Description
align="left" Aligns your cell contents to the LEFT.
10
HTML Table
11
HTML Table
Align Description
valign=“top" Aligns contents to the TOP of the cell.
valign=“middle" Aligns contents halfway BETWEEN the top
and bottom of the cell.
valign=“bottom" Aligns contents to the BOTTOM of the cell.
12
HTML Table
13
HTML Table
Syntax :
<table border="1">
OUTPUT
14
HTML Table
OUTPUT
15
HTML Table
HTML Table Headings - Align
• The align attribute specifies the horizontal alignment of the content in a header cell.
<th align="left|right|center|justify|char">
Value Description
left Left-aligns content
right Right-aligns content
center Default for <th>. Center-aligns content
justify Stretches the lines so that each line has equal width (like in newspapers
and magazines)
char Aligns the content to a specific character
16
HTML Table
OUTPUT
17
HTML Table
OUTPUT <td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$100</td>
</tr>
<tr>
<td colspan="2">Sum: $180</td>
</tr>
</table> 18
HTML Table
1. Create a HTML webpage with a table have three columns and three rows.
21
Activity 2.7: HTML Table
2. Write HTML to create the table below
22
Activity 2.8 : HTML Table
3. Write HTML to create the table below using colspan and rowspan
23
Activity 2.9 : HTML Table
4. Write HTML to create the table below using colspan and rowspan
24