TABLEeee Tag
TABLEeee Tag
WITH
TABLES
When we need to represent data in form of rows and columns we use a
container tag called <table>.
Each row is divided into one or more cells/ columns which can either be a
HEADER CELL or a DATA CELL.
001 ABC
HEADER CELL
The caption can appear either at top or at bottom of the table created. This can
be done by using ALIGN attribute of <caption tag>.
It is used immediately after opening <table> and before adding any table row
EXAMPLE
Align attribute of <caption>
ATTRIBUTES OF TABELS
1. BORDER ATTRIBUTE
This attribute draws an inside and an outside border of the table.
When value of border is more than 1 then only the outside border changes but
the inside always remains 1.
Not adding border attribute will not add boundary to the table.
EXAMPLE
EXAMPLE – NO BORDER
2. ALIGN ATTRIBUTE- RIGHT, LEFT, CENTER
OUTPUT
3. WIDTH ATTRIBUTE
If width= 100% it means that it spans across entire browser window.
Width attribute is used with border, if we omit this attribute the width of the
table is set according to characters inside the cells.
EXAMPLE
4. HEIGHT ATTRIBUTE
5. BORDERCOLOR ATTRIBUTE
BORDERCOLOR attribute could be used to add border color to the table border
The output of table border color have different way of rendering in different
browsers like Netscape Navigator and MS Internet Explorer.
EXAMPLE
OUTPUT
OUTPUT OF GOOGLE
CHROME
OUTPUT OF INTERNET EXPLORER
6. TABLE BORDER- LIGHT and DARK ATTRIBUTE
Visual web browsers such as Netscape Navigator & Internet Explorer render
table borders with 3D appearance.
Mozilla Firefox shows light grey and dark grey in TOPLEFT and BOTTOMRIGHT.
EXAMPLE
OUTPUT
EXAMPLE
OUTPUT- MOZILLA FIREFOX
7. TABLE BACKGROUND COLOR
It helps in setting background color of the table.
EXAMPLE
8. <FONT> TAG WITH TABLE
9. ADDING BACKGROUND IMAGE IN TABLE
OUTPUT
CELLPADDING
Cellpadding attribute indicates how many pixels of space there should
be between the cells content and the border of the table.
It does not affects the function of <TH> and <TD>. It only creates ‘n’
pixel between the cell and boundaries(top, left, right, bottom cell
boundaries)- IT IS NOT AFFECTED BY NUMBER OF CHARACTERS
EXAMPLE
OUTPUT
CELLPADDING NOT AFFECTED BY NUMBER OF
CHARACTERS
OUTPUT
CELLSPACING
Cell spacing attribute indicates how many pixels of white spaces
should be there between individual cells.
Spacing of cells.
If we want to give nice header to the table colspan is used with <TD>
tag.
OUTPUT
GHOST CELLS
ROWSPAN
When the tables cell span across more than one row, it is called
ROWSPAN.