Html table attributes

In Introduction to tables in html tutorial you have learnt basic step for making html table. Now I am explaining here useful html table attributes one by one. Html table is formatted with these attributes.



Width attribute
We may specify table width in pixels or in percentage by using width attribute. If we want fixed we should specify in pixels. And if we want proportionate width then use percentage.

Example of table with fix width 





S. NoNamePhone
1Johan45632
2Alice69632
3Johan52364

 
S. No Name Phone
1 Johan 45632
2 Alice 69632
3 Johan 52364

Example of table with proportionate width





S. NoNamePhone
1Johan45632
2Alice69632
3Johan52364


S. No Name Phone
1 Johan 45632
2 Alice 69632
3 Johan 52364

Border attribute
If we want frame around a table we may use Border attribute. This attribute helps in distingush the cells of table. Border attribute value is set in numbers like 1,2, 3........

Example


S. NoNamePhone
1Johan45632
2Alice69632
3Johan52364

S. No Name Phone
1 Johan 45632
2 Alice 69632
3 Johan 52364

Cellspacing attribute
This attribute places white space between table cells






S. NoNamePhone
1Johan45632
2Alice69632
3Johan52364


S. No Name Phone
1 Johan 45632
2 Alice 69632
3 Johan 52364

Cellpadding attribute

With this attribute we may place white between cell and its content.






S. NoNamePhone
1Johan45632
2Alice69632
3Johan52364


S. No Name Phone
1 Johan 45632
2 Alice 69632
3 Johan 52364