HTML Tables | Learn HTML

HTML Tables

The HTML tables can be represent as <table> start tag and </table> end tag that will displays information in form of rows and columns or we can say tabular form.

HTML tables are used to manage the layout of the page like header, navigation bar, body content, footer section etc. But it is recommended to use div tag over table to manage the layout of the web page.

Tag Description
<table> It is used to create a table.
<tbody> It is used to group the body content in a table.
<thead> It is used to group the header content in a table.
<tr> It defines a row in a table.
<th> It defines a header cell in a table.
<td> It defines a cell in a table.
<colgroup> It specifies a group of one or more columns in a table for formatting.
<caption> It defines the table caption.
<col> It is used with <colgroup> element to specify column properties for each column.
<tfooter> It is used to group the footer content in a table.

HTML Tables Tag | Tech-Mirror
HTML Table Tag | Tech-Mirror

HTML Table Example

HTML Table with Border

Output:


There are lots of different options for tables like Cellpadding, Cellspacing, border, align, valign, and many others.

Cellpadding :– Space within the cells
Cellspacing :– Space between the cells
Border :– Puts a border around the cells and table
Align :– Aligns the content of the table (left, right, center)
Valign :– Vertically aligns the content (top, middle, bottom)

Cellpadding, Cellspacing and Border should only used in the table tag. and Align and Valign can be used in td,tr, and table tags.

For More Learn Basic HTML Tags

Leave a Reply

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