Welcome to our comprehensive guide on HTML tables, brought to you by TutorialsPoint! In this article, we'll delve into the world of HTML tables, helping you understand their structure, purpose, and various attributes.

HTML tables, denoted by the <table> tag, are invaluable for displaying data in a structured and organized manner. Whether you're showcasing a product catalog, a movie listing, or a financial report, tables provide the perfect canvas for your data.

Understanding the Basic Structure of HTML Tables
Before we dive into the nitty-gritty, let's familiarize ourselves with the basic structure of an HTML table.

An HTML table is composed of the following tags:
<table>: Defines an HTML table<tr>: Defines a table row<th>: Defines a table header cell<td>: Defines a table data cell

Creating a Simple Table
Let's create a simple table with two columns and three rows, containing information about TutorialsPoint.
<table>
<tr>
<th>Topic</th>
<th>Description</th>
</tr>
<tr>
<td>HTML</td>
<td>HyperText Markup Language</td>
</tr>
<tr>
<td>CSS</td>
<td>Cascading Style Sheets</td>
</tr>
</table>

Headers and Data Cells
In the above example, notice that the table has a header row (defining the column names) and two data rows (presenting the actual content). Use the <th> tag for header cells and <td> for data cells.
Table Attributes and Features

HTML tables come with a host of attributes and features that enhance their functionality and appearance. Let's explore some of them.
Border Attribute




















The border attribute defines the thickness of the table's border. By default, it is set to 1, but you can adjust it or set it to 0 for no border.
<table border="2"> results in a thick table border.
Cellspacing and cellpadding
The cellspacing attribute defines the space between cell borders, while the cellpadding attribute sets the space between cell walls and cell content.
<table border="1" cellspacing="10" cellpadding="5"> creates a table with a 1-pixel border, 10 pixels between cell borders, and 5 pixels between cell walls and content.
Aligning and Grouping Table Data
Tables often need to be manipulated for better presentation. HTML provides align and colspan/rowspan attributes for this purpose.
Column Alignment with align Attribute
The align attribute aligns the text within cells to the left (left), right (right), or center (center).
<td align="center">Centered Text</td> centers the text within the cell.
Grouping Columns and Rows with colspan and rowspan
The colspan attribute merges cells horizontally, while rowspan does so vertically. To use these attributes, specify the number of columns or rows to merge.
<td colspan="2">Two Columns</td> merges the current cell with the cell to its right.
With this comprehensive guide, you're now equipped to create and manipulate HTML tables like a pro! Now go ahead and structure your data like never before. Happy coding!