What is Table ?

Table in HTML: Table basically a combination of row and column which is used to store a data or large amount of data. For initialisation of table you need to use table tag <table>. In which there is a need to use a table row <tr>, table header <th>, table data/cell <td>. Without this combination ,table is not draw.

  1. <tr> Table row: In (tr) table row defined. It is a row. Row in a table always follow horizontal process.
  2. <td> Table row: In (td) table data defined. Table data in a table always follow vertical process.
  3. <th>: Table header: It work like a heading of a content, whenever you write anything in table header your content automatically become bold.

Attribute of Table Tag

  1. Border: If you want to see a proper structure of table then you need to use border attribute.
  2. Cell Padding: This will provide a space between content and its border. You can said that it provide an inner space. It is the space between the outer edges of the table cell and the content of cell.
  3. Cell Spacing: This will provide a space between cell. It set a space from one cell to another cell. It provide an outer space. It is a space between the individual cells.
  4. Width: It provide a width to the table, by this width wise area of table will be increased.
  5. Height: It provide a height to the table, by this height wise area of table will be increased.
  6. Align: It will set an alignment of the table like left, center, right.
  7. Bgcolor: It will set a background colour of table, you can also give that property to any particular row.
  8. Valign: This will set a vertical alignment of a content by using its value like: Top, Middle, Bottom.

 

An HTML table is defined with the <table> tag. Each table row is defined with the <tr> tag. A table header is defined with the <th> tag.

<table> </table> Starting Table tag and ending tag. <tr></tr> Table Rows tag and ending tag.<td></td> Table Data tag and ending tag.<th></th> Table head tag and ending tag.
Example 1

Example 2

Rowspan and Colspan:

Both rowspan and colspan are the attribute of table header and table data.They both are used for merging a cell. Some time there is a need to merge a multiple row and column, at that time it is more used. This is used for header cell that titles a group of columns, or a side bar that groups row of entries. The value of both these attributes rowspan and colspan should be positive integer(whole number), in which value specify about the number of column and row that cell fill.

1.Rowspan: In which rows are merged. It specify the number of row a cell span. It allow table cell to merge the height of more than one cell or row.

2.Colspan: It merge the column of the table. In which the width of the more than one cell or column are merged. In which number of column a cell span.

(Visited 84 times, 1 visits today)
Share with Friends :
Written by:

Leave a Reply

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