HTML Tables

HTML tables are used to display data in a structured grid format. They are a fundamental part of web design and enable the organization and presentation of data in rows and columns. In this tutorial, we will explore how to create tables in HTML.


Basic Table Structure

HTML tables are created using the <table> element. A table consists of rows defined by the <tr> element and columns defined by the <th> (table header) and <td> (table data) elements. Here's a simple example:


Basic HTML Table

Here's a basic example of an HTML table:


Table Border

You can set the border of a table using the border attribute within the <table> element. The value represents the border thickness.


Table Sizes

You can control the size of tables using the width and height attributes within the <table> element. These attributes specify the dimensions of the table in pixels or as a percentage of the available space.

For example, the following code sets the table width to 50% of the available space: