Friday, July 25, 2008

Tables

The main table tags are -
  • <table> - This element is a container for all the other table elements
  • <tr> - This tag creates a row in the table
  • <th> - This tag creates a heading row in the table
  • <td> - Creates a cell within a row
The table tag The table tag can only contain tr tags.
The summary attribute
This attribute contains a string that describes the contents of the table. It is used by non-visual browsers. It may also be used by search engines to index a page.
The tr tag
The tr tag creates rows in the table. This tag can only contain td or th tags.
The td and th tags
The td elements create cells within the rows. Therefore, they are always contained in tr tags. The th elements are used to create heading cells. They operate in the same way as td elements. The only difference is in the way they are rendered by the browser - header cell text is usually rendered in bold and centered.
These tags can contain any content - text, images, lists and even other tables.
If one of the rows in a table has less cells than the others, a blank space is created at the end of the rows, the same size as the missing cells.

No comments: