Tables

Tables:
A table is a two dimensional matrix, consisting of rows and columns. It can be used for more than just displaying a table of data. All table related tags are included between the <table>…</table> tags. Table rows can be of two types. A row that spans across columns of a table is called the header row. It is defined using <th>…</th> tags. Individual data cells placed in the horizontal plane creates a data row. Each row of a table is described between the <tr>…</tr> tags. Each column of a table is described between the <td>…</td> tags. The <table> tag takes the following attributes:

 

Align

Horizontal alignment is controlled by the Align attribute. It can be set to Left, Center or Right

VAlign

Controls the vertical alignment of cell contents. It accepts the values Top, Middle or Bottom

Border

Controls the border to be placed around the table. The border thickness is specified in pixels

Width

Specifies the width of the table in pixels or percentage

Cellpadding

Controls the distance between the data in a cell and the boundaries of the cell

Cellspacing

Controls the spacing between adjacent cells

Colspan

Combine more than one column

Rowspan

Combine more than one row

<Caption> tag:
Tables need to be given a heading. Table headings are called Captions. Captions can be provided to a table by using the <caption> ….. </caption> tags. This tag have the align attributes. It controls placing of the caption in the table. It can be set to Top or Bottom.

 

Example:

<table border="7" cellpadding="7" cellspacing="10">
<tr bgcolor="#00ff00">
<td>a green row.</td>
<td bgcolor="#ffff00">this cell should be yellow, overriding the row color.</td> <td>back to the row color.</td>
<tr bgcolor="#0000ff">
<td>a blue row.</td>
<td><pre> </pre></td>
<td rowspan="2">this cell takes the color of the topmost row that it spans</td>
</tr>
<tr bgcolor="#ff0000">
<td>a red row.</td>
</tr>
</table>

Output:

 

 

 

 

 

 

 

 

 

 

 

 

hyper text markup language by deepa & suriya