You are on page 1of 7

ASSIGNMENTS 1

FP531: MOBILE DEVELOPMENT

SET TABLE & CELL COLOUR

Tables can be created using <table> tag.

<tr> is used to create columns of the table.


<td> is used to hold the table content or data. <th> is for the header. <bgcolor> is used to set the background color of the table.

EXAMPLE

<table border="1" bgcolor="red"> <tr> <th>Name</th> <th>Class</th> </tr>

<tr>
<td>Tiong</td> <td>DNS6B</td> </tr>

<tr>
<td>Amin</td> <td>DNS6B</td> </tr>

</table>

CREATE CELL PADDING, TABLE & CELL SPACING

To create cell padding, use the <table cellpadding=pixel"> syntax. For the table & cell spacing, use <table cellspacing="pixels"> syntax.

EXAMPLE
<table border="1" cellspacing="10" cellpadding="10"> <tr cellspacing="100"> <th >Name</th>

<th >Age</th>
</tr> <tr> <td>Khai</td> <td>18</td> </tr> </table>

No cell spacing and cell padding

With cell spacing and cell padding

ALIGN TEXT IN CELLS (HORIZONTALLY, VERTICALLY)

Text can be aligned to left, middle, or right by using <align=value> syntax. To align text to the top, middle, or bottom, use <valign=value> syntax.

EXAMPLE
<table border="1" width="200" height="100"> <tr> <td align="left" valign="top">Left, Top</td> <td align="middle" valign="middle">Middle, Middle</td> <td align="right" valign="bottom">Right, Bottom</td>

</tr>
</table>

You might also like