HTML Tables

HTML tables are used to display data in a tabular format. these are created using the <table> tag and consist of

  1. header: defined using the <th> tag
  2. rows:    defined using the <tr> tag
  3. cell :     defined using the <td> tag.

Here is an example of a basic HTML table:

We can also specify the number of columns and rows a table should have using the colspan and rowspan attributes. Also, we can use CSS to style the table, such as adding borders, changing the background color, and adjusting the font size.

Below is the example with different style in table:

Note: it’s recommended to use CSS to style the tables rather than using the in-line style as it makes the code more readable and maintainable.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top