Basic Syntax of HTML Table
<table>
<tr>
<th></th>
<th></th>
...
</tr>
<tr>
<td></td>
<td></td>
...
</tr>
...
</table>
Example: Here is an example of HTML table with two rows and three columns.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Basic HTML Table</title>
</head>
<body>
<table border="1">
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
<tr>
<td>Row 3, Column 1</td>
<td>Row 3, Column 2</td>
</tr>
</table>
</body>
</html>
Note: The border attribute is not supported by HTML5. CSS border property is used to set the table border in HTML5.
Output:
How to Create Table in HTML?
HTML tables are essential for organizing and displaying data in a structured format on web pages. Creating a table in HTML is a fundamental skill for web developers. It is used for product information, presenting data analytics, or designing a pricing comparison chart, etc. This article provides a step-by-step guide on how to create tables in HTML.
Table of Content
- Elements of HTML Table
- Table Structure
- Basic Syntax of HTML Table
- Adding Table Heading to Rows
- HTML Table with thead, tbody, and tfoot Elements
Contact Us