Html Table
“HTML” table is used to arrange data(i.e. text, image and other content ) in a table. It can used as a layout of a web page. A website layout consists of header, footer, right and left column and main center content.
Html Tabel Structure
There are three html element which are used to form a html table, TABLE, TR (Table Row) and TD (Table Data)
HTML Code will be:
<table>
<tr>
<td>A </td>
<td> B </td>
</tr>
<tr>
<td> C </td>
<td> D </td>
</tr>
</table>
Displaying on browser will be:
The Align Attribute
Left and right value are usually used with Align Attribute because, by default a table is aligned to the left margin. Like < table align=”center or right” >
Html code will be;
<table align=”center”>
<tr>
<td>A </td>
<td> B </td>
</tr>
<tr>
<td> C </td>
<td> D </td>
</tr>
</table>
Displaying on browser, will be:
The Bordered Attribute
The thickness of the table border in pixels, default is 0. a html table opening tag with border attribute will be like this: < table align=”center” border=”5” >
Html code will be;
<table align=”center” border=”5”>
<tr>
<td>A </td>
<td> B </td>
</tr>
<tr>
<td> C </td>
<td> D </td>
</tr>
</table>
Displaying on browser, well be:
The Attributes WIDTH And HEIGHT
You can set with and height of a table with “width “and “height attributes. Width or height size can be in pixel or in percentage. . a html table opening tag with border attribute will be like this: < table align=”center” border=”5” width=”500” height=”200” > or < table align=”center” border=”5” width=”50%” height=”20%” >
Html code will be;
<table align=”center” border=”5” width=”500” height=”200”>
<tr>
<td>A </td>
<td> B </td>
</tr>
<tr>
<td> C </td>
<td> D </td>
</tr>
</table>
Displaying on browser, well be:
|