Monday 3 April 2017

TABLE element in HTML

TABLE ELEMENT:-
                                It is a container element started by <TABLE> tag and ended by </TABLE> tag. It is the basic element for creating a table.

Syntax:-
<TABLE ALIGN="Alignment" BGCOLOR="colorname" BORDER="n">
. . .
....
.....
</TABLE>

Attributes of TABLE element:

ALIGN:-Specifies the horizontal placement of the table in relation to the window screen. LEFT aligns the table to the left (the default). RIGHT aligns the table to the right. CENTER aligns the table to the center.

Syntax: 
ALIGN = "Alignment"

BGCOLOR:-Sets the colour of the background for the table.

Syntax:
BGCOLOR = "colorname"

BORDER:-Sets the border size (width of the boundaries) of the table.

Syntax:
BORDER = "n" - where n is a natural number.

TABLE ROW (TR) element:-
                                                It is a container element started by <TR> tag and ended by </TR> tag. It is used to define table rows. The TR element is used inside the TABLE element. The number of rows in a table corresponds to the instances of the TR element within the table element. The contents of a row are given as a parameter to the TR element. The contents of a table row may contain TH tags, which indicate table headings, and TD tags, which indicate table data.

Syntax:
<TR ALIGN ="Alignment" VALIGN="VAlignment" BGCOLOR="colorname"> 
. . . 
......
.......
< / TR >

VALIGN:-This controls whether the text in a row is aligned to the top, bottom, or middle of a cell. BOTTOM aligns the content with the cell's bottom. MIDDLE centres the content within the cell
(the default). TOP aligns the content with the cell's top.

Syntax:
VALIGN = "VAlignment"

TABLE DATA (TD) element:-
                                                   It is a container element started by <TD> tag and ended by </TD> tag. It is used to specify the text in a cell of the table. The TD tag is used inside the TR tag, which is inside the table tag. The number of columns in a table depends on the number of TD elements within the TR element.

Syntax:
<TD ALIGN="Alignment" VALIGN="VAlignment" BGCOLOR="colorname" >
 . . . 
....
.....
</TD>

The attributes ALIGN, VALIGN, and BGCOLOR have their usual meaning as defined in <TR>
element.





TABLE HEADING (TH) element -
                                                          It is a container element started by <TH> tag and ended by </TH> tag. It is used to create header values. The header values are displayed in a bold font and center aligned. The TH element is used to create column or row headings.

Syntax:
<TH ALIGN ="Alignment" VALIGN = "VAlignment"BGCOLOR = "colorname" NOWRAP >
. . .
.....
.......
</TH>


  • NOWRAP - Specifies that the contents of a cell cannot be broken, i.e., they do not wrap onto the next line.

2 comments:

  1. how to show the tbody, thead, tfoot tag in table.

    ReplyDelete
  2. < table >
    < thead >< tr >< td >.....< /td >< td >....< /td >< /tr >< /thead>
    < tbody >< tr >< td >.....< td >....< /td >< /tr >
    < tr >< td >.....< td >....< /td >< /tr >< /tbody >
    < tfoot >< tr >< td >.....< td >....< /td >< /tr >< /tfood >< /table >

    ReplyDelete