HTML Table - cellpadding, cellspacing
- cellpadding - this is used to add space around the inner content of table cells.
- cellspacing - this is used to add space around the table cells.
Here is an example where the the cellpadding and cellspacing has been set to 10 pixels:
Here is the code:
Note: You're probably thinking what the hell is this <style> and border-xxx business. Well its C.S.S. or Cascading Style Sheets.
Its used here to add a border around the table cells and the table itself. I did not want to start showing you C.S.S. just yet, but the border really helps emphasise colspan, cellpadding and cellspacing.
see the css tutorial for more
Example same as before but with no cellpadding i.e. cellpadding="0px" or the cellpadding attribute removed from the code:
Note: the border of the cells is very tight around the content of the cells (the 1, 2, and 3 values). Cellpadding add space around the content.
Example same as before but with no cellspacing i.e. cellspacing="0px" or the cellspacing attribute removed from the code::