Category: 

What is an HTML Table Tag?

Article Details
  • Written By: M.R. Anglin
  • Edited By: Bronwyn Harris
  • Last Modified Date: 04 December 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
A recent study suggests that former acne sufferers are more likely to retain a youthful appearance as they age.  more...

December 9 ,  1979 :  The eradication of smallpox was certified.  more...

An author of a web page has many options in how to display data when using Hypertext Markup Language (HTML), including an HTML table tag. The HTML table tag is used by web page writers to organize data into tables for easier viewing. Different types of data, including text, images, and even other tables, can be inserted into the table cells. A variety of different elements and attributes can be used within the HTML table tag. A person wanting to input a table within an HTML document will need to understand these various components and how they work together.

The HTML table tag can be used to organize data into columns and rows. Columns are vertical lines of data and rows are horizontal lines. The HTML author can only insert data into the rows of a table because once the rows are inserted the columns will line themselves up. Some of the elements used within the HTML table tag are <tr>, <td>, and <th> which define the table row, table data, and table header, respectively. Attributes can be used to define the look and spacing of the rows.

Ad

If an HTML author wants a table to look just right, there are a variety of different attributes he can use to do so. The right attributes can change characteristic like the color of the text, the spacing between the cells, the background color of the table, and the borders. There are even ways to get rid of borders completely so that they do not show up in the user’s browser. While an author cannot directly change the data in the columns, he can change the different characteristics of the columns. To do this, he can use elements such as <col> and <colgroup>.

In order to input a table into an HTML document, the table start tag <table> must be used. Within the element, the author can define various attributes about the table such as the color, border, and spacing. Next, the author needs to define the table row using the element <tr>. This tells the browser that the data to follow is to be placed in a row. After this the table data—the actual information to be displayed—is inputted after the <td> element. It is important that the various tags are closed in sequence in order to prevent confusion in any subsequent editing.

An example of how an HTML document may look when an author wants to use the HTML table tag is as follows:

<table>
<tr>
<td>This is cell 1</td>
<td>This is cell 2</td>
</tr>

<tr>
<td>This is cell 3</td>
<td>This is cell 4</td>
</tr>
</table>

This example will produce a four celled table with two columns down and two rows across.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email