0% found this document useful (0 votes)
10 views2 pages

Table

Tables in HTML are defined with <table> tags and contain rows (<tr>), data cells (<td>), and header cells (<th>). Tables can include multiple rows and columns of data with headers to label the information. Attributes like rowspan and colspan allow cells to span multiple rows or columns.

Uploaded by

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

Table

Tables in HTML are defined with <table> tags and contain rows (<tr>), data cells (<td>), and header cells (<th>). Tables can include multiple rows and columns of data with headers to label the information. Attributes like rowspan and colspan allow cells to span multiple rows or columns.

Uploaded by

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

HTML Tables

Tables are defined with the <table> tag.

A table is divided into rows (with the <tr> tag), and each row is divided into data cells
(with the <td> tag). td stands for "table data," and holds the content of a data cell. A <td>
tag can contain text, links, images, lists, forms, other tables, etc.

Header information in a table are defined with the <th> tag.


All major browsers will display the text in the <th> element as bold and centered.

Example:
<html>
<title>
paragraph tag
</title>
<body>
<table border="1">
<tr> <th>Heading 1</th> <th>Heading 2</th> </tr>
<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>
</table>
</body>
</html>

How the HTML code above looks in your browser:

Header 1 Header 2
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2

Example: caption, rowspan, colspan


<html>
<title>
paragraph tag
</title>
<body>
<table border="1">
<caption>Sample Table </caption>
<tr> <th>Heading 1</th> <th>Heading 2</th><th>Heading 3</th> </tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
<td rowspan="2">Data 3</td>
</tr>
<tr>
<td colspan="2">Data 4</td>
</tr>
</table>
</body>
</html>

You might also like