Creating Table in HTML
Creating Table in HTML
Course :cse
Semester :5th
Subject : WD
Faculty: Ms. Monika Aggarwal
Topic Creating Tables in HTML
TABLE
• Tables allow you to organize and
arrange data into columns and rows.
Tables also allow you to divide your
page into section where you can
place headers, footers and
navigation links. Almost all Web
sites are laid out using tables.
TABLE
• A table is made up of rows and
columns. You can place different
elements in each cell like text,
images and hyperlinks.
Creating a Table
Tables arrange and organize content into
columns and rows. Basically, they can
be made via the following container
tags:
• <table></table>- tag that creates the table,
instructs the browser that a table is being
made.
• <tr></tr> - tag that sets off each row in a
table.
• <td></td> - tag that sets off each cell
Table Heading
<tr>
<td>Ramesh Raman</td>
<td>5000</td>
</tr>
<tr>
<td>Shabbir Hussein</td>
<td>7000</td>
</tr> </table>
</body> </html>
COLSPAN AND ROWSPAN ATTRIBUTES
<html> <head>
<title>HTML Table Colspan/Rowspan</title>
</head> <body>
<table border = "1">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
Cont..
<tr>
<td rowspan = "2">Row 1 Cell 1</td>
<td>Row 1 Cell 2</td>
<td>Row 1 Cell 3</td>
</tr>
<tr>
<td>Row 2 Cell 2</td>
<td>Row 2 Cell 3</td>
</tr>
<tr>
<td colspan = "3">Row 3 Cell 1</td>
</tr>
</table>
</body>
</html>
Table Header, Body, and Footer:
<thead> − to create a separate table header.
<tbody> − to indicate the main body of the table.
<tfoot> − to create a separate table footer.
</tbody>
<tfoot>
<tr>
<td>Sum</td>
<td>$180</td>
</tr>
</tfoot>
</table>
HTML <tfoot> Tag
Definition and Usage
The <tfoot> tag is used to group footer content in an
HTML table.
<tr>
<td>February</td>
<td>$80</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>Sum</td>
<td>$180</td>
</tr>
</tfoot>
</table>