Trusted answers to developer questions

What is an HTML table?

Get the Learn to Code Starter Pack

Break into tech with the logic & computer science skills you’d learn in a bootcamp or university — at a fraction of the cost. Educative's hand-on curriculum is perfect for new learners hoping to launch a career.

An HTML table is used for the ​arrangement of data in rows and columns, or possibly in a more complex structure.

svg viewer

Defining tables in HTML

An HTML table is defined with the <table> tag. Following are some basic tags used for specifying the features of a table:

  • <tr> tag is used to define each row in a table.
  • <th> tag is used to define headers of a table.
  • <td> tag is used to define a table data or a cell.

By default, table headings are bold and centered while data is non-bold and left aligned.

Example:

Below is an example of defining a basic HTML table:

For easy reading of the table, line 4-8 are used to add borders to the headers and data cells.

  • HTML

RELATED TAGS

html
table
<table>
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?