Example Code:
<table border=1 bgcolor=green>
<tr>
<td>
This is 1st row 1st column
</td>
<td>
This is 1st row 2nd column
</td>
</tr>
<tr>
<td>
This is 2nd row 1st column
</td>
<td background="./test.jpg">
This is 2nd row 2nd column
<br><br>
Nice background
</td>
</tr>
</table>
Result:
The result for above tag will be as
This is 1st row 1st column | This is 1st row 2nd column | ||||||||||||||||
This is 2nd row 1st column | This is 2nd row 2nd column Nice background | Table Size We can set the size of the table based of pixels or percentage. First we will see how to set size based on pixels. The attribute width and height will be used. Example Code: <table border=1 bgcolor="green" width=300 height=100> <tr height=30> <td> This is 1st row 1st column </td> <td> This is 1st row 2nd column </td> </tr> <tr height=70> <td> This is 2nd row 1st column </td> <td background="./test.jpg"> This is 2nd row 2nd column <br><br> Nice background </td> </tr> </table> Now we have set the total table width as 300 and height as 100 and split them as 30 to first row and 70 to second row. Result:
This is 1st row 1st column | This is 1st row 2nd column |
This is 2nd row 1st column | This is 2nd row 2nd column Nice background |
This is 1st row 1st column | This is 1st row 2nd column | ||||||||
This is 2nd row 1st column | This is 2nd row 2nd column Nice background | Table Alignment Tables can be aligned to the left/right/center using the attribute "align" inside table tag. Example Code: <table border=1 bgcolor="green" width=300 height=100 align=center> <tr height=30> <td> HAI </td> <td> Hello </td> </tr> <tr height=70> <td> Table Alignment </td> <td background="./test.jpg"> This is 2nd row 2nd column <br><br> Nice background </td> </tr> </table> Result:
HAI | Hello |
Table Alignment | This is 2nd row 2nd column Nice background |
center | right |
top | bottom right |
No comments:
Post a Comment