Pr.Pg Next Pg

TABLE attributes tutorials

  • Following are the attributes of <TABLE> tag element.

BORDER = No of Pixels

CELLSPACING = No of Pixels

CELLPADDING = No of Pixels

WIDTH = No of Pixel or Screen%

HEIGHT = No of Pixel or Screen%

ALIGN = LEFT/RIGHT/CENTER

BGCOLOR = COLOR NAME or Hexadecimal code

Have a look in the below table at result of attributes set within <TABLE> .

 

Sr No

Attributes

Descriptions

1

BORDER

This attribute of <TABLE> tags element helps you to specify border around the table. By default Border is set to 0 and due to this table is drawn without Border. If you give any Positive value other than zero, Table with border will be drawn.

2

CELLSPACING

This attribute of <TABLE> tag set the space between the cells to 10 pixels.

3

CELLPADDING

This attribute of <TABLE> tag set the space between the cell wall and the cell content to 10 pixels.

4

WIDTH

This attribute of <TABLE> tag specifies the width of the table.

5

HEIGHT

This attribute of <TABLE> tag specifies the height of the table.

6

ALIGN

This attribute of <TABLE> tag set the position of table to center, left and right.

7

BGCOLOR

This attribute of <TABLE> tag set the table background color

 

Syntax:

<body>

<table attributes=value>

..

..

</table>

</body>

 

Example: HTML program to demonstrate different attributes of table tag

Output:
Example: HTML program to fill background color in table

Output:
Pr.Pg border                                              Next Pg