0% found this document useful (0 votes)
17 views9 pages

Class-Work 3

The document contains multiple HTML examples demonstrating various table features such as vertical headers, left-aligned headers, colspan, rowspan, and the use of <colgroup> and <thead><tbody><tfoot> tags. Each example includes the HTML structure and relevant CSS styles for formatting tables. Additionally, it illustrates how to add captions and organize data effectively within tables.

Uploaded by

aman707937
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views9 pages

Class-Work 3

The document contains multiple HTML examples demonstrating various table features such as vertical headers, left-aligned headers, colspan, rowspan, and the use of <colgroup> and <thead><tbody><tfoot> tags. Each example includes the HTML structure and relevant CSS styles for formatting tables. Additionally, it illustrates how to add captions and organize data effectively within tables.

Uploaded by

aman707937
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Name- Aman Kuamr Gupta

Reg No- 23BCY10119


Date- 31-10-2025

Vertical Table Headers

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<table>
<tr>
<th>Firstname</th>
<th>Jill</th>
<th>Eve</th>
</tr>
<tr>
<td>Lastname</td>
<td>Smith</td>
<td>Jackson</td>
</tr>
<tr>
<td>Age</td>
<td>94</td>
<td>50</td>
</tr>
</table>
</body>
</html>

Render Page:
Align Table Headers

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
th{
text-align: left;
}
</style>
</head>
<body>
<h2>Left-align Headers</h2>
<p>To left-align the table headers, use the CSS text-align
property.</p>

<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
</body>
</html>

Render Page:

Header for Multiple Columns

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<table style="width:100%" border="black">
<tr>
<th colspan="2">Name</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
</body>
</html>

Render Page:

Table Caption

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
th,td{
padding: 5px;
text-align: left;
}
</style>
<body>
<h2>Table Caption</h2>
<p>To add a caption to a table, use the caption tag.</p>

<table style="width: 100%" border="black">


<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Saving</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>
</body>
</html>

Render Page:

HTML Table - Colspan

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<table border="black">
<tr>
<th colspan="2">Name</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>43</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>57</td>
</tr>
</table>
</body>
</html>

Render Page:

HTML Table - Rowspan

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<table border="black">
<tr>
<th>Name</th>
<th>Jill</th>
</tr>
<tr>
<th rowspan="2">Phone</th>
<td>555-1234</td>
</tr>
<tr>
<td>555-8745</td>
</tr>
</table>
</body>
</html>

Render Page:

HTML <colgroup> and <col> Tag

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<table border="black">
<colgroup>
<col span="2" style="background-color: red;">
<col style="background-color: yellow;">
</colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
<tr>
<td>5869207</td>
<td>My first css</td>
<td>$49</td>
</tr>
</table>
</body>
</html>

Render Page:

HTML <thead><tbody><tfoot> Tag


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<table border="black">
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
</thead>
<tr>
<th>January</th>
<th>$100</th>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
<tfoot>
<tr>
<td>Sum</td>
<td>$100</td>
</tr>
</tfoot>
</body>
</html>

Render Page:

You might also like