HTML Old School

TABLE tag

The basic tag is <table></table> .

It has the following attributes:

 

1. width=" pixels | %"

Defines the table width. Dont write width="300px". Write width="300" !

Example: 0901table_table_width.html

 

 2. height="pixels | %"

 Defines the table height. If we put % then table height will be percent of the current browser's window height.

Example in px: 0902table_table_height.html

Example in %: 0902table_table_heightpercent.html

 

3. align="left | center | right"

 Align table in relation to text in browser's window.

Example:  0903table_table_align.html

 

 4. cellspacing="px | %" & cellpadding="px | %"

 Cellspacing defines distance between table cells, and cellpadding defines distance between text and cell border.

cellpadding:  0904table_table_cellpadding.html

cellspacing: 0904table_table_cellspacing.html

 

5. background="./path/to/image.jpg"

Defines table background image.

Example: 0905table_table_background.html

 

 6. bgcolor="#FCF"

Defines table background color.

Example: 0906table_table_bgcolor.html

 

7. border="5"

Defines border width in pixels.

To define border color use CSS: style="border: 5px solid Red"

border and CSS style: 0907table_table_border.html

 

 

 Notice:

Most of these attributes are obsolete in HTML5. So use CSS when creating HTML tables.