Table Handling in HTML
- Tables In HTML
-
-
Tables are very useful to arrange in HTML and they are used very frequently by almost all web developers.
-
Tables are just like spreadsheets and they are made up of rows and columns.
-
The table element is used to create tables , with appropriate headers to identify the data contained in each column and row.
-
Creating Tables
At its most basic, a table is built using 4 tags:
<table>
Used as Container tag
<tr>
Used to generate row
<td>
Used to generate column
<th> Used to generate column heading
General Syntax
<table >
<tr>
<td> some data</td>
<td>some data</td>
</tr>
<tr>
<td>some data</td>
<td>some data</td>
</tr>
</table>
Creating Header Cells
-
Two types of cells can be defined in an HTML table. One of them is the simple cell , created using <td> tag.
-
The other one is a special type of cell created using <th> element, that contains header information for a set of specified cells.
-
Browsers render the content of header cells in a special way ,as centered bold text
- Various Attribute Of <table> Tag
- Table tag has following important attributes:
-
<border> Sets the border width in numerical values from 0 and up.
-
<cellspacing> Empty space between table data cells.
-
<cellpadding> Empty space between the edge of a cell and cell content.
-
<align>Aligns the table to the left, right or center.
-
<width> and <height> The width/height of the table; measured in pixels or percentage.
-
<bgcolor> Background color for all cells that do not have a background color or image specified.
-
<background> Background image for all cells that do not have a background color or image specified.
-
<bordercolor> Border color for the table.