HTML – Basic Tables
HTML tables allow for data to be arranged into rows and columns using the table
tag, which contains the tr
tag for rows and the td
tag for data cells.
HTML tables allow for data to be arranged into rows and columns using the table
tag, which contains the tr
tag for rows and the td
tag for data cells.
Table size, borders, cell padding, cell spacing, can all be changed by using attributes. Multiple rows or columns can be merged into one.
Advanced HTML tables may contain thead
, tbody
, and tfoot
tags, along with a caption, within the table to give the data better structure.
The caption
tag defines a table caption. It must be inserted immediately after the opening table
tag and will be centered above the table by default.
The colgroup
tag specifies a group of one or more columns in a table for formatting using the col
tag and applying formatting to entire columns.
The col
tag specifies column properties for each column within a colgroup
tag. This is useful for applying styles to entire columns.
The tbody
tag is used to group the body content in the table. It’s used in conjunction with the thead
and tfoot
elements to specify each part of a table.
A td
tag defines a cell containing data in a table. The number of td
tags in a table row (tr
) determines the number of columns in that row.
The tfoot
tag is used to group the body content in the table. It’s used in conjunction with the thead
and tbody
elements to specify each part of a table.
A th
tag defines a header (thead
) cell containing data in a table. The number of th
tags in a table row (tr
) determines the number of columns in that row.
The thead
tag is used to group header content in a table. It’s used in conjunction with the tbody
and tfoot
elements to specify each part of a table.
A table
tag defines a table consisting of a number rows and columns, and optionally a header row, footer row, and caption.
A tr
tag defines a row of cells (td
) containing data in a table. The number of td
tags in a table row (tr
) determines the number of columns in that row.
The col
tag specifies column properties for each column within a colgroup
tag. These are the attributes that can be used.
A td
tag defines a cell containing data in a table. These are its attributes.
A th
tag defines a header thead
cell containing data in a table. These are its attributes.
HTML tables can be styled to a point using tag attributes like border, cell-padding, cell-spacing, and width. But tables can be greatly improved with CSS.
The border-collapse property sets whether table borders should collapse into a single border or remain separated as is the default.
The border-spacing property sets the distance between the borders of adjacent cells. This property only works when border-collapse is set to separate.
The caption-side property specifies the placement of a table caption to the top or bottom.
Thanks for your support!
All are affiliate links. Thank you for your support!