Saturday, September 08, 2007

ATTRIBUTE ON TABLE IN HTML CODE


BORDER

Border use to make a border in the table, when border attribute didn't place in the table the preview not look a table. The value on the pixels.

for example :

<TABLE>
<TR>
<TD>A</TD><TD>B</TD>
</TR>
</TABLE>

The preview like this



AB
But you can see if the table have a border attribute like this example:

<TABLE BORDER=1>
<TR>
<TD>A</TD><TD>B</TD>
</TR>
</TABLE>

Here is the result



AB
You can see the different from both, isn't ?

CELLSPACING AND CELLPADDING


To give a distance of cell use the cellspacing atribute, but if you want to give distance cell with the text/content of column use the cellpadding attribute.

The example like this -- Contohnya sbb:

<TABLE BORDER=1 CELLPADDING=5 CELLSPACING=5>
<TR>
<TD>A</TD><TD>B</TD>
</TR>
</TABLE>

Here the result



AB
WIDTH AND HEIGHT

Width use to arrange wide of the table, its can use pixels or percent value. To arrange hight of the table you can use Height attribute.

For example -- Contohnya

<TABLE BORDER=1 CELLPADDING=5 CELLSPACING=5 WIDTH=250 HEIGHT=250>
<TR>
<TD>A</TD><TD>B</TD>
</TR>
</TABLE>

Here the result



AB
BGCOLOR or BACKGROUND

Do you remember BGCOLOR dan BACKGRAUND atribute in BODY tag? the function is same, but it use to give a background of the table. IF the background is color you can use the bgcolor attribute but if the background is picture use the background attribute.

The example using background color :

<TABLE BGCOLOR="blue" BORDER=1 CELLPADDING=5 CELLSPACING=5 WIDTH=250 HEIGHT=250>
<TR>
<TD>A</TD><TD>B</TD>
</TR>
</TABLE>

The result



AB
The example using background picture :

<TABLE BACKGROUND="01.jpg" BORDER=1 CELLPADDING=5 CELLSPACING=5 WIDTH=250 HEIGHT=250>
<TR>
<TD>A</TD><TD>B</TD>
</TR>
</TABLE>

The result



AB


To be Continued....

0 Comments:

Post a Comment

<< Home