DEV Community

wasifali
wasifali

Posted on • Updated on

HTML tables, why we use and how to use?

HTML Tables:

HTML tables are used to arrange the data into rows and columns.
A table in HTML consists of table cells inside rows and columns.
To create the table we will use different tags, where the main one is
<table> </table>.
<table> defines the table.
<tr> defines a row within the table.
<th> defines header cells within the row
<td> defines data cells within the row.

Table cells:

Each table cell is defined by a <td> and a </td> tag.
td stands for table data.

HTML Table border:

HTML tables can have borders of different styles and shapes.

How To Add a Border

To add a border, use the CSS border property on table, th, and td elements:

Example

table, th, td {
  border: 1px solid black;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)