DEV Community

Visali Nedunchezhian
Visali Nedunchezhian

Posted on

HTML tables

In HTML, you can create tables for your website using the <table> tag in conjunction with the <tr>, <td> and <th> tags.

The HTML tables allow displaying the data (e.g. image, text, link) in columns and rows of cells. Table rows can be grouped into a head, foot, and body sections through the<thead>, <tfoot> and <tbody> elements, respectively.

In HTML5,we can place <tfoot>either before or after <tbody> tag.They must come after any <caption>, <colgroup>, and <thead> elements.

Most of the attributes of the <table> element are not used in HTML5. If you want to style the appearance of the table, you can use CSS instead.

Spanning Multiple Rows and Columns

It is possible to extend rows and columns of a table across many other rows and columns.

Commonly, a table cell cannot pass into the space, which is below or above another cell. But, if you want to span several rows or columns in a table, you can use the colspan or rowspan attributes.

Adding Captions to Tables

You can use the <caption> element to specify a caption for tables. It should be placed immediately after the opening <table> tag. By default, the caption will be at the top of the table, but its position can be changed with the CSS caption-side property.

Top comments (0)