HTML <table> tag

HTML <table> tag

The <table> tag specifies an HTML table.

A basic HTML table contains the following child elements.

  1. table row (<tr>)
  2. header cell (<th>)
  3. data cell (<td>)

A complex HTML table may also include the following child elements.

  1. caption (<caption>)
  2. column (<col>)
  3. column group (<colgroup>)
  4. table header (<thead>)
  5. table body (<tbody>)
  6. table footer (<tfoot>)

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <table> <tr> <th>S.No</th> <th>Name</th> </tr> <tr> <td>1</td> <td>Brendan</td> </tr> <tr> <td>2</td> <td>Eich</td> </tr> </table> </body> </html>

Attributes

There is no special attributes for <table> tag. Only Global attributes.

Deprecated Attributes

The following attributes should not be used in any case.

AttributeValueExplanation
align
  • left
  • center
  • right
Specifies how the table must be aligned inside the containing document.
bgcolor
  • color name
  • #RRGGBB
Specifies the background color of a table.
border
  • 1
  • 0
Specifies whether to apply a border for a table or not.
cellpaddingpxSpecifies the space between the content of a cell and its border.
cellspacingpxSpecifies the space between two cells.
frame
  • above
  • below
  • hside
  • vside
  • lhs
  • rhs
  • border
  • box
  • void
Specifies which side of the frame surrounding the table must be displayed.
rules
  • none
  • groups
  • rows
  • columns
  • all
Specifies how the line in the table should appear.
summarytextSpecifies an alternative text that summarizes the content of the table.
widthpx / %Specifies the width of the table.

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Meet the Author